home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / me39doc.arc / EMACS.MSS < prev    next >
Encoding:
Text File  |  1987-06-29  |  110.4 KB  |  2,765 lines

  1. @style(indent 8 chars, spacing 1 lines)
  2. @pagefooting()
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.         @b(MicroEMACS)
  16.  
  17.         Full Screen Text Editor
  18.         Reference Manual (preliminary draft)
  19.  
  20.         Version 3.9
  21.         June 29, 1987
  22.  
  23.         (C)opyright 1987 by Daniel M. Lawrence
  24.         Reference Manual (C)opyright 1987
  25.             by Brian Straight and Daniel M. Lawrence
  26.         All Rights Reserved
  27.  
  28.         @i(MicroEMACS 3.9 can be copied and distributed freely
  29.         for any non-commercial purposes. MicroEMACS 3.9 can
  30.         only be incorporated into commercial software with
  31.         the permission of the current author.)
  32. @newpage
  33. @flushleft(@b[Introduction])
  34.  
  35.     MicroEMACS is a tool for creating and changing documents,
  36. programs, and other text files.  It is both relatively easy for the
  37. novice to use, but also very powerfull in the hands of an expert.
  38. MicroEMACS can be extensively customized for the needs of the
  39. individual user.
  40.  
  41.     MicroEMACS allows several files to be edited at the same time.
  42. The screen can be split into different windows, and text may be moved
  43. freely from one window to the next.  Depending on the type of file being
  44. edited, MicroEMACS can change how it behaves to make editing simple. 
  45. Editing standard text files, program files and wordprocessing documents
  46. are all possible at the same time.
  47.  
  48.     There are extensive capabilities to make word processing and
  49. editing easier.  These include commands for string searching and
  50. replacing, paragraph reformatting and deleting, automatic word wrapping,
  51. word move and deletes, easy case controling, and automatic word counts.
  52.  
  53.     For complex and repetitive editing tasks editing macroes can be
  54. written.  These macroes allow the user a great degree of flexibility in
  55. determining how MicroEMACS behaves.  Also any and all the commands can
  56. be used by any keystroke by changing, or rebinding, what commands
  57. various keys are connected, or bound, to. 
  58.  
  59.     Special features are also available to perform a diverse set of
  60. operations such as file encryption, automatic backup file generation,
  61. entabbing and detabbing lines, executing of DOS commands and filtering
  62. of text through other programs (like SORT to allow sorting text).
  63.  
  64. @flushleft(@b[History])
  65.  
  66.     EMACS was originally a text editor written by Richard Stahlman
  67. at MIT in the early 1970s for Digital Equipment computers. Various
  68. versions, rewrites and clones have made an appearence since.
  69.  
  70.     This version of MicroEMACS is derived from code written by Dave
  71. G.  Conroy in 1985.  Later modifications were performed by Steve Wilhite
  72. and George Jones.  In December of 1985 Daniel Lawrence picked up the
  73. then current source (version 2.0) and has made extensive modifications
  74. and additions to it over the course of the next two years.  Updates and
  75. support for the current version is still in progress.  The current
  76. program author can be contacted by writing to:
  77.  
  78. @begin(verbatim)
  79.     USMAIL:    Daniel Lawrence
  80.         617 New York St
  81.         Lafayette, IN 47901
  82.  
  83.     UUCP:    ihnp4!pur-ee!pur-phy!duncan!lawrence
  84.     ARPA:    nwd@@j.cc.purdue.edu
  85.     FIDO:    Fido 201/2 The Programmer's Room (317) 742-5533
  86. @end(verbatim)
  87. @string(ChapterTitle="")
  88. @set(page = 0)
  89. @pageheading(even, left "@title[Chapter]", right "MicroEMACS Reference Manual")
  90. @pageheading(odd, left "MicroEMACS Reference Manual", right "@title[Chapter]")
  91. @pagefooting(even, left="@value(page)")
  92. @pagefooting(odd, right="@value(page)")
  93. @chapter(Basic Concepts)
  94.  
  95.     The current version of MicroEMACS is 3.9 (Third major re-write,
  96. eighth public release, Ith (or ninth) minor release), and for the rest of
  97. this document, we shall simply refer to this version as "EMACS".  Any
  98. modifications for later versions will be listed in the appendixes at the
  99. end of this manual. 
  100.  
  101. @section(Keys and the Keyboard)
  102.  
  103.     Many times throught this manual we will be talking about
  104. @index(special keys) commands and the keys on the keyboard needed use
  105. them.  There are a number of "special" keys which can be used and are
  106. listed here:
  107.  
  108. @begin(description)
  109. <NL>@\NewLine which is also called RETURN or ENTER, this key is used to
  110. @index(newline) end different commands. 
  111.  
  112. ^@\The control key can be used before any alphabetic character and some
  113. symbols.  For example, ^C means to hold down the <CONTROL> key and type
  114. @index(control key) the C key at the same time. 
  115.  
  116. ^X@\The CONTROL-X key is used at the beginning of many different
  117. @index(control-x) commands. 
  118.  
  119. META or M-@\This is a special EMACS key used to begin many commands as
  120. @index(meta key) well.  This key is pressed, and then released before
  121. typing the next character.  On most systems, this is the <ESC> key, but
  122. it can be changed.  (consult appendix D to learn what key is used for
  123. META on your computer).
  124. @end(description)
  125.  
  126. Whenever a command is described, the manual will list the actual
  127. keystokes needed to execute it in @b(boldface) using the above
  128. conventions, and also the name of the command in @i(italics).
  129. @section(Getting Started)
  130.  
  131.     In order to use EMACS, you must call it up from your system's or
  132. computer's command prompt.  On UNIX and MSDOS machines, just type
  133. "emacs" from the main command prompt and follow it with the <RETURN> or
  134. <ENTER> key (we will refer to this key as <NL> for "new-line" for the
  135. remainder of this manual).  On the Macintosh, the Amiga, the ATARI ST
  136. and other icon based operating systems, double click on the uEMACS icon.
  137. Shortly after this, a screen similar to the one below should appear.
  138.  
  139. @section(Parts and Pieces)
  140.  
  141.     The screen is divided into a number of areas or @b<windows>.  On
  142. some systems the top window contains a function list of unshifted and
  143. @index(windows) shifted function keys.  We will discuss these keys later. 
  144. @index(mode line) Below them is an EMACS @b<mode line> which, as we will
  145. see, informs you of the present mode of operation of the editor--for
  146. example "(WRAP)" if you set EMACS to wrap at the end of each line. 
  147. @index(text window) Under the mode line is the @b<text window> where text
  148. appears and is manipulated.  Since each window has its own mode line,
  149. below the text window is it's mode line.  The last line of the screen is
  150. the @b(command line) where EMACS takes commands and reports on what it
  151. is doing. 
  152.  
  153. @begin(verbatim)
  154. ===============================================================================
  155. f1 search      f2 search back : F1 toggle function list F2 toggle help file
  156. f3 hunt        f4 hunt back   : F3 find command/apropos F4 describe key
  157. f5 next window f6 exec macro  : F5 reformat paragraph    F6 ref undented region 
  158. f7 find file   f8 exec file   : F7 indent region    F8 undent region
  159. f9 save file  f10 exit emacs  : F9 execute DOS command F10 shell up
  160. ===============================================================================
  161. -- MicroEMACS 3.9 () -- Function Keys ---------------------------------------
  162. ===============================================================================
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175. ===============================================================================
  176. -- MicroEMACS 3.9 () -- Main ------------------------------------------------
  177. ===============================================================================
  178.         Fig 1:    EMACS screen on an IBM-PC
  179. @end(verbatim)
  180.  
  181. @section(Entering Text)
  182.  
  183. Entering text in EMACS is simple.  Type the following sentence fragment:
  184.  
  185. @quotation<Fang Rock lighthouse, center of a series of mysterious and>
  186.  
  187. @flushleft(The text is displayed at the top of the text window.  Now type:)
  188.  
  189. @quotation<terrifying events at the turn of the century>
  190.  
  191. Notice the text to the left of the cursor disappears and a '$' sign
  192. appears.  Don't panic--your text is safe!!! You've just discovered that
  193. EMACS doesn't "wrap" text to the next line like most word processors
  194. unless you hit <NL>.  But since EMACS is used for both word processing,
  195. and text editing, it has a bit of a dual personality.  You can change
  196. @index(modes) the way it works by setting various @b(modes).  In this
  197. case, you need to set @b(WRAP) mode, using the @i(add-mode)
  198. @index(add-mode) command, by typing @b(^X-M).  The command line at the
  199. base of the screen will prompt you for the mode you wish to add.  Type
  200. @b<wrap> followed by the <NL> key and any text you now enter will be
  201. wrapped.  However, the command doesn't wrap text already entered.  To
  202. get rid of the truncated line, delete characters with the <BACKSPACE>
  203. key until the '$' goes away.  Now type in the words you deleted, watch
  204. how EMACS goes down to the next line at the right time.  @i{(In some
  205. versions of EMACS, @b<WRAP> is a default mode in which case you don't
  206. have to worry about the instructions relating to adding this mode.)}
  207.  
  208. Now let's type a longer insert.  Hit <NL> a couple of times to tab
  209. down from the text you just entered.  Now type the following paragraphs. 
  210. Press <NL> twice to indicate a paragraph break. 
  211.  
  212. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  213. terrifying events at the turn of the century, is built on a rocky island
  214. a few miles of the Channel coast.  So small is the island that wherever
  215. you stand its rocks are wet with sea spray. 
  216.  
  217. The lighthouse tower is in the center of the island.  A steep flight of
  218. steps leads to the heavy door in its base.  Winding stairs lead up to
  219. the crew room.>
  220.  
  221. @section<Basic cursor movement>
  222.  
  223. Now let's practice moving around in this text.  To move the cursor back
  224. to the word "Winding," enter @b<M-B> @i(previous-word)
  225. @index(previous-word).  This command moves the cursor backwards by one
  226. word at a time.  Note you have to press the key combination every time
  227. the cursor steps back by one word.  Continuously pressing META and
  228. toggling B produces an error message.  To move forward to the word
  229. "stairs" enter @b<M-F>, which moves the cursor forward by one word at a
  230. time. 
  231.  
  232. Notice that EMACS commands are usually mnemonic--F for forward, B for
  233. backward, for example.
  234.  
  235. To move the cursor up one line, enter @b<^P> @i(previous-line)
  236. @index(previous-line), down one line @b<^N> @i(next-line)
  237. @index(next-line).  Practice this movement by moving the cursor to the
  238. word "terrifying" in the second line. 
  239.  
  240. The cursor may also be moved forward or backward in smaller increments. 
  241. To move forward by one character, enter @b<^F> @i(forward-character)
  242. @index(forward-character), to move backward, @b<^B>
  243. @i(backward-character) @index(backward-character).  EMACS also allows
  244. you to specify a number which is normally used to tell a command to
  245. execute many times.  To repeat most commands, press META and then the
  246. number before you enter the command.  Thus, the command META 5 ^F
  247. (@b<M-5^F>) will move the cursor forward by five characters.  Try moving
  248. around in the text by using these commands.  For extra practice, see how
  249. close you can come to the word "small" in the first paragraph by giving
  250. an argument to the commands listed here. 
  251.  
  252. Two other simple cursor commands that are useful to help us move around
  253. in the text are @b<M-N> @i(next-paragraph) @index(next-paragraph) which
  254. moves the cursor to the second paragraph, and @b<M-P>
  255. @i(previous-paragraph) @index(previous-paragraph) which moves it back to
  256. the previous paragraph.  The cursor may also be moved rapidly from one
  257. end of the line to the other.  Move the cursor to the word "few" in the
  258. second line.  Press @b<^A> @i(beginning-of-line)
  259. @index(beginning-of-line).  Notice the cursor moves to the word "events"
  260. at the beginning of the line.  Pressing @b<^E> @i(end-of-line)
  261. @index(end-of-line) moves the cursor to the end of the line. 
  262.  
  263. Finally, the cursor may be moved from any point in the file to the end
  264. or beginning of the file.  Entering @b{M->} @i(end-of-file)
  265. @index(end-of-file) moves the cursor to the end of the buffer, @b{M-<}
  266. @i(beginning-of-file) @index(beginning-of-file) to the first character
  267. of the file. 
  268.  
  269. @i(On the IBM-PC, the ATARI ST and many other machines, the cursor keys
  270. @index(cursor keys) can also be used to move the cursor about.  Also, if
  271. there is one available, moving the mouse will move the cursor.)
  272.  
  273. Practice moving the cursor in the text until you are comfortable with
  274. the commands we've explored in this chapter.
  275.  
  276. @section(Saving your text)
  277.  
  278. When you've finished practicing cursor movement, save your file.  Your
  279. @index(buffer) file currently resides in a @b<BUFFER>.  The buffer is a
  280. temporary storage area for your text, and is lost when the computer is
  281. turned off.  You can save the buffer to a file by entering @b<^X-^S>
  282. @i(save-file) @index(save-file).  Notice that EMACS informs you that
  283. your file has no name and will not let you save it. 
  284.  
  285. To save your buffer to a file with a different name than it's current
  286. one (which is empty), press @b<^X^W> @i(write-file) @index(write-file). 
  287. EMACS will prompt you for the filename you wish to write.  Enter the
  288. name @b<fang.txt> and press return.  On a micro, the drive light will
  289. come on, and EMACS will inform you it is writing the file.  When it
  290. finishes, it will inform you of the number of lines it has written to
  291. the disk. 
  292.  
  293. Congratulations!! You've just saved your first EMACS file!
  294. @newpage
  295. @heading(Chapter @value(chapter) Summary)
  296.  
  297.     In chapter @value(chapter), you learned how to enter text, how
  298. to use wrap mode, how to move the cursor, and to save a buffer.  The
  299. following is a table of the commands covered in this chapter and their
  300. corresponding key bindings:
  301.  
  302. @begin{verbatim}
  303. @u(Key Binding        Keystroke    Effect)
  304.  
  305. abort-command        @b<^G>        aborts current command
  306.  
  307. add-mode        @b<^XM>        allows addition of EMACS
  308.                     mode such as @b(WRAP)
  309.  
  310. backward-character    @b<^B>        moves cursor left one character
  311.  
  312. beginning-of-file    @b{M-<}        moves cursor to beginning of file
  313.  
  314. beginning-of-line    @b<^A>        moves cursor to beginning of line
  315.  
  316. end-of-file        @b{M->}        moves cursor to end of file
  317.  
  318. end-of-line        @b<^E>        moves cursor to end of line
  319.  
  320. forward-character    @b<^F>        moves cursor right one character
  321.  
  322. next-line        @b<^N>        moves cursor to next line
  323.  
  324. next-paragraph        @b<M-N>        moves cursor to next paragraph
  325.  
  326. next-word        @b<M-F>        moves cursor forward one word
  327.  
  328. previous-line        @b<^P>        moves cursor backward by one line
  329.  
  330. previous-paragraph    @b<M-P>        moves cursor to previous paragraph
  331.  
  332. previous-word        @b<M-B>        moves cursor backward by one word
  333.  
  334. save-file        @b<^X-^S>    saves current buffer to a file
  335.  
  336. write-file        @b<^X-^W>    save current buffer under a new name
  337. @end(verbatim)
  338. @newpage
  339. @chapter(Basic Editing--Simple Insertions and Deletions)
  340.  
  341. @section<A Word About Windows, Buffers, Screens, and Modes>
  342.  
  343. In the first chapter, you learned how to create and save a file in
  344. EMACS.    Let's do some more editing on this file.  Call up emacs by
  345. typing in the following command.
  346.  
  347. @b<emacs fang.txt>
  348.  
  349. @i(On icon oriented systems, double click on the uEMACS icon, usually a
  350. file dialog box of some sort will appear.  Choose @b(FANG.TXT) from the
  351. appropriate folder.)
  352.  
  353. Shortly after you invoke EMACS, the text should appear on the screen
  354. ready for you to edit.  The text you are looking at currently resides in
  355. a @b<buffer>.  A buffer is a temporary area of computer memory which is
  356. @index(buffer) the primary unit internal to EMACS -- this is the place
  357. where EMACS goes to work.  The mode line at the bottom of the screen
  358. lists the buffer name, @b<FANG.TXT> and the name of the file with which
  359. this buffer is associated, @b<FANG.TXT>
  360.  
  361. The computer talks to you through the use of its @b(screen).  This
  362. @index(screen) screen usually has an area of 24 lines each of 80
  363. characters across.  You can use EMACS to subdivide the screen into
  364. several separate work areas, or @b(windows), each of which can be
  365. @index(window) 'looking into' different files or sections of text.  Using
  366. windows, you can work on several related texts at one time, copying and
  367. moving blocks of text between windows with ease.  To keep track of what
  368. you are editing, each window is identified by a @b(mode line) on the
  369. @index(mode line) @index(buffer) last line of the window which lists the
  370. name of the @b(buffer) which it is looking into, the file from which the
  371. text was read, and how the text is being edited. 
  372.  
  373. An EMACS @b<mode> tells EMACS how to deal with user input.  As we have
  374. already seen, the mode 'WRAP' controls how EMACS deals with long lines
  375. (lines with over 79 characters) while the user is typing them in.  The
  376. 'VIEW' mode, allows you to read a file without modifying it.  Modes are
  377. associated with buffers and not with files; hence, a mode needs to be
  378. explicitly set or removed every time you edit a file.  A new file read
  379. into a buffer with a previously specified mode will be edited under this
  380. mode.  If you use specific modes frequently, EMACS allows you to set
  381. the modes which are used by all new buffers, called @b<global> modes. 
  382.  
  383. @section<Insertions>
  384.  
  385. Your previously-saved text should look like this:
  386.  
  387. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  388. terrifying events at the turn of the century, is built on a rocky island
  389. a few miles of the Channel coast.  So small is the island that wherever
  390. you stand its rocks are wet with sea spray. 
  391.  
  392. The lighthouse tower is in the center of the island.  A steep flight of
  393. steps leads to the heavy door in its base.  Winding stairs lead up to
  394. the crew room.>
  395.  
  396. Let's assume you want to add a sentence in the second paragraph after
  397. the word "base."  Move the cursor until it is on the "W" of "Winding".
  398. Now type the following:
  399.  
  400. @quotation<This gives entry to the lower floor where the big steam
  401. generator throbs steadily away, providing power for the electric
  402. lantern.>
  403.  
  404. If the line fails to wrap and you end up with a '$' sign in the right
  405. margin, just enter @b{M-Q} @i(fill-paragraph) @index(fill-paragraph) to
  406. reformat the paragraph.  This new command attempts to fill out a
  407. paragraph.  Long lines are divided up, and words are shuffled around to
  408. make the paragraph look nicer. 
  409.  
  410. Notice that all visible EMACS characters are self-inserting -- all you
  411. had to do was type the characters to insert and the exisiting text made
  412. space for it.  With a few exceptions discussed later, all non-printing
  413. characters (such as control or escape sequences) are commands.  To
  414. insert spaces, simply use the space bar.  Now move to the first line of
  415. the file and type @b{^O} @i(open-line) @index(open-line) (Oh, not zero). 
  416. You've just learned how to insert a blank line in your text. 
  417.  
  418. @section<Deletions>
  419.  
  420. EMACS offers a number of deletion options.  For example, move the cursor
  421. until it's under the period at the end of the insertion you just did. 
  422. Press the backspace key.  Notice the "n" on "lantern" disappeared.  The
  423. backspace implemented on EMACS is called a @b<destructive> backspace--it
  424. removes text immediately before the current cursor position from the
  425. buffer.  Now type @b<^H> @i(delete-previous-character)
  426. @index(delete-previous-character).  Notice that the cursor moves back
  427. and obliterates the "r"--either command will backspace the cursor. 
  428.  
  429. Type in the two letters you erased to restore your text and move the
  430. cursor to the obeginning of the buffer @b{M->} @i(beginning-of-file)
  431. @index(beginning-of-file).  Move the cursor down one line to the
  432. beginning of the first paragraph. 
  433.  
  434. To delete the forward character, type @b{^D} @i(delete-next-character)
  435. @index(delete-next-character).  The "F" of "Fang" disappears.  Continue
  436. to type @b{^D} until the whole word is erased EMACS also permits the
  437. deletion of larger elements of text.  Move the cursor to the word
  438. "center" in the first line of text.  Pressing @b{M-<backspace>}
  439. @i(delete-previous-word) @index(delete-previous-word) kills the word
  440. immediately before the cursor.  @b{M-^H} has the same effect. 
  441.  
  442. Notice that the commands are very similar to the control commands you
  443. used to delete individual letters.  As a general rule in EMACS, control
  444. sequences affect small areas of text, META sequences larger areas.  The
  445. word forward of the cursor position can therefore be deleted by typing
  446. @b{M-D} @i(delete-next-word) @index(delete-next-word).  Now let's take
  447. out the remainder of the first line by typing @b{^K}
  448. @i(kill-to-end-of-line) @index(kill-to-end-of-line).  You now have a
  449. blank line at the top of your screen.  Typing @b{^K} again or @b{^X-^O}
  450. @i(delete-blank-lines) @index(delete-blank-lines) deletes the blank line
  451. and flushes the second line to the top of the text.  Now exit EMACS by
  452. typing @b{^X-^C} @i(exit-emacs) @index(exit-emacs).  Notice EMACS
  453. reminds you that you have not saved your buffer.  Ignore the warning and
  454. exit.  This way you can exit EMACS without saving any of the changes you
  455. just made. 
  456.  
  457. @heading(Chapter @value(chapter) Summary)
  458.  
  459. In Chapter @value(chapter), you learned about the basic 'building
  460. blocks' of an EMACS text file--buffers, windows, and files. 
  461.  
  462. @begin{verbatim}
  463. @u(Key binding        Keystroke    Effect)
  464. delete-previous-character
  465.             @b{^H}        deletes character immediately before
  466.                     the current cursor position
  467.  
  468. delete-next-character    @b{^D}        deletes character immediately after     
  469.                     current cursor position
  470.  
  471. delete-previous-word    @b{M-^H}    deletes word immediately before
  472.                     current cursor position
  473.  
  474. delete-next-word    @b{M-D}        deletes word immediately after
  475.                     current cursor position
  476.  
  477. kill-to-end-of-line    @b<^K>        deletes from current cursor
  478.                     position to end of line
  479.  
  480. insert-space        @b<^C>        inserts a space to right of cursor
  481.  
  482. open-line        @b{^O}        inserts blank line
  483.  
  484. delete-blank-lines    @b{^X-^O}    removes blank line
  485.  
  486. exit-emacs        @b{^X-^C}    exits emacs
  487. @end(verbatim)
  488. @chapter(Using Regions)
  489.  
  490. @section(Defining and Deleting a Region)
  491.  
  492. At this point its time to familiarize ourselves with two more EMACS
  493. terms--the @b<point> and the @b<mark>.  The point is located directly
  494. @index(point) @index(mark) behind the current cursor position.  The mark
  495. (as we shall see shortly) is user defined.  These two elements together
  496. are called the current @b(region) and limit the @b<region> of text on
  497. which EMACS performs many of its editing functions. 
  498.  
  499. Let's begin by entering some new text.  Don't forget to add @b(wrap)
  500. mode if its not set on this buffer.  Start EMACS and open a file called
  501. @b{PUBLISH.TXT}.  Type in the following text:
  502.  
  503. @quotation{One of the largest growth areas in personal computing is
  504. electronic publishing.  There are packages available for practically
  505. every machine from elegantly simple programs for the humble Commodore 64
  506. to sophisticated professional packages for PC and Macintosh computers. 
  507.  
  508. Electronic publishing is as revolutionary in its way as the Gutenburg
  509. press.  Whereas the printing press allowed the mass production and
  510. distribution of the written word, electronic publishing puts the means
  511. of production in the hands of nearly every individual.  From the class
  512. magazine to the corporate report, electronic publishing is changing the
  513. way we produce and disseminate information. 
  514.  
  515. Personal publishing greatly increases the utility of practically every
  516. computer.  Thousands of people who joined the computer revolution of
  517. this decade only to hide their machines unused in closets have
  518. discovered a new use for them as dedicated publishing workstations.}
  519.  
  520. Now let's do some editing.  The last paragraph seems a little out of
  521. place.  To see what the document looks like without it we can cut it
  522. from the text by moving the cursor to the beginning of the paragraph. 
  523. Enter @b(M-<space>) @i(set-mark) @index(set-mark).  EMACS will respond
  524. with "[Mark set]".  Now move the cursor to the end of the paragraph. 
  525. You have just defined a region of text.  To remove this text from the
  526. screen, type @b<^W> @i(kill-region) @index(kill-region).  The paragraph
  527. disappears from the screen. 
  528.  
  529. On further consideration, however, perhaps the paragraph we cut wasn't
  530. so bad after all.  The problem may have been one of placement.  If we
  531. could tack it on to the end of the first paragraph it might work quite
  532. well to support and strengthen the argument.  Move the cursor to the end
  533. of the first paragraph and enter @b<^Y> @i(yank) @index(yank).  Your
  534. text should now look like this:
  535.  
  536. @quotation{One of the largest growth areas in personal computing is
  537. electronic publishing.  There are packages available for practically
  538. every machine from elegantly simple programs for the humble Commodore 64
  539. to sophisticated professional packages for PC and Macintosh computers. 
  540. Personal publishing greatly increases the utility of practically every
  541. computer.  Thousands of people who joined the computer revolution of
  542. this decade only to hide their machines unused in closets have
  543. discovered a new use for them as dedicated publishing workstations. 
  544.  
  545. Electronic publishing is as revolutionary in its way as the Gutenburg
  546. press.  Whereas the printing press allowed the mass production and
  547. distribution of the written word, electronic publishing puts the means
  548. of production in the hands of nearly every individual.    From the class
  549. magazine to the corporate report, electronic publishing is changing the
  550. way we produce and disseminate information.}
  551.  
  552. @section(Yanking a Region)
  553.  
  554. The text you cut initially didn't simply just disappear, it was cut into
  555. a buffer that retains the 'killed' text appropriately called the @b<kill
  556. buffer>.  @b<^Y> "yanks" the text back from this buffer into the current
  557. buffer. If you have a long line (indicated, remember, by the "$"
  558. sign), simply hit @b{M-Q} to reformat the paragraph. 
  559.  
  560. There are other uses to which the kill buffer can be put.  Using the
  561. @index(kill buffer) method we've already learned, define the last
  562. paragraph as a region.  Now type @b<M-W> @i(copy-region)
  563. @index(copy-region).  Nothing seems to have happened; the cursor stays
  564. blinking at the point.  But things have changed, even though you may not
  565. be able to see any alteration. 
  566.  
  567. To see what has happened to the contents of the kill buffer, move the
  568. cursor down a couple of lines and "yank" the contents of the kill buffer
  569. back with @b<^Y>.  Notice the last paragraph is now repeated.  The
  570. region you defined is "tacked on" to the end of your file because
  571. @b<M-W> @b<copies> a region to the kill buffer while leaving the
  572. original text in your working buffer.  Some caution is needed however,
  573. because the contents of the kill buffer are updated when you delete any
  574. regions, lines or words.  If you are moving large quantities of text,
  575. complete the operation before you do any more deletions or you could
  576. find that the text you want to move has been replaced by the most recent
  577. deletion.  Remember--a buffer is a temporary area of computer memory
  578. that is lost when the machine is powered down or switched off.  In order
  579. to make your changes permanent, they must be saved to a file before you
  580. leave EMACS.  Let's delete the section of text we just added and save
  581. the file to disk. 
  582.  
  583. @heading(Chapter @value(chapter) Summary)
  584.  
  585. In Chapter @value(chapter), you learned how to achieve longer insertions
  586. and deletions.  The EMACS terms @b<point> and @b<mark> were introduced
  587. and you learned how to manipulate text with the kill buffer. 
  588.  
  589. @begin{verbatim}
  590. @begin(group)
  591. @u(Key Binding    Keystroke    Effect)
  592.  
  593. Delete-Region    @b{^W}        Deletes region between point and mark and
  594.                 places it in KILL buffer
  595.  
  596. Copy-Region    @b{M-W}        Copies text between point and mark into
  597.                 KILL buffer
  598.  
  599. Yank-Text    @b{^Y}        Inserts a copy of the KILL buffer into
  600.                 current buffer at point
  601. @end(group)
  602. @end(verbatim)
  603. @chapter(Search and Replace)
  604.  
  605. @section<Forward Search>
  606.  
  607. Load EMACS and bring in the file you just saved.  Your file should look
  608. like the one below.
  609.  
  610. @quotation{One of the largest growth areas in personal computing is electronic
  611. publishing.  There are packages available for practically every machine
  612. from elegantly simple programs for the humble Commodore 64 to
  613. sophisticated professional packages for PC and Macintosh computers. 
  614. Personal publishing greatly increases the utility of practically every
  615. computer.  Thousands of people who joined the computer revolution of
  616. this decade only to hide their machines unused in closets have
  617. discovered a new use for them as dedicated publishing workstations. 
  618.  
  619. Electronic publishing is as revolutionary in its way as the Gutenburg
  620. press.  Whereas the printing press allowed the mass production and
  621. distribution of the written word, electronic publishing puts the means
  622. of production in the hands of nearly every individual.    From the class
  623. magazine to the corporate report, electronic publishing is changing the
  624. way we produce and disseminate information.}
  625.  
  626. Let's use EMACS to search for the word "revolutionary" in the second
  627. paragraph.  Because EMACS searches from the current cursor position
  628. toward the end of buffers, and we intend to search forward, move the
  629. cursor to the beginning of the text.  Enter @b<^S> @i(search-forward)
  630. @index(search-forward).  Note that the command line now reads
  631.  
  632. "Search [] <META>:" 
  633.  
  634. EMACS is prompting you to enter the @b<search string> -- the text you
  635. want to find.  Enter the word @b<revolutionary> and hit the @b<META>
  636. key.  The cursor moves to the end of the word "revolutionary."
  637.  
  638. Notice that you must enter the <META> key to start the search.  If you
  639. @index(<NL>) simply press <NL> the command line responds with "<NL>". 
  640. Although this may seem infuriating to users who are used to pressing the
  641. return key to execute any command, EMACS' use of <META> to begin
  642. searches allows it to pinpoint text with great accuracy.  After every
  643. line wrap or carriage return, EMACS 'sees' a new line character (<NL>). 
  644. If you need to search for a word at the end of a line, you can specify
  645. this word uniquely in EMACS. 
  646.  
  647. In our sample text for example, the word "and" occurs a number of times,
  648. but only once at the end of a line.  To search for this particular
  649. occurance of the word, move the cursor to the beginning of the buffer
  650. and type @b(^S).  Notice that EMACS stores the last specified
  651. @index(default string) search string as the @b<default> string.  If you
  652. press @b{<META>} now, EMACS will search for the default string, in this
  653. case, "revolutionary."
  654.  
  655. To change this string so we can search for our specified "and" simply
  656. enter the word @b{and} followed by @b{<NL>}.  The command
  657. line now shows:
  658.  
  659. "search [and<NL>]<META>:"
  660.  
  661. Press @b{<META>} and the cursor moves to "and" at the end of the second
  662. last line.
  663.  
  664. @section<Exact Searches>
  665.  
  666. If the mode EXACT is active in the current buffer, EMACS searches on a case
  667. sensitive basis.  Thus, for example you could search for @b{Publishing}
  668. as distinct from @b{publishing}. 
  669.  
  670.  
  671. @section<Backward Search>
  672.  
  673. Backward searching is very similar to forward searching except that it
  674. is implemented in the reverse direction.  To implement a reverse search,
  675. type @b{^R} @i(search-reverse) @index(search-reverse).  Because EMACS
  676. makes no distinction between forward and backward stored search strings,
  677. the last search item you entered appears as the default string.  Try
  678. searching back for any word that lies between the cursor and the
  679. beginning of the buffer.  Notice that when the item is found, the point
  680. moves to the beginning of the found string (i.e., the cursor appears
  681. under the first letter of the search item). 
  682.  
  683. Practice searching for other words in your text.
  684.  
  685. @section<Searching and Replacing>
  686.  
  687. Searching and replacing is a powerful and quick way of making changes to
  688. your text.  Our sample text is about electronic publishing, but the
  689. correct term is 'desktop' publishing.  To make the necessary changes we
  690. need to replace all occurances of the word "electronic" with "desktop."
  691. First, move the cursor to the top of the current buffer with the @b(M-<)
  692. command.  Then type @b[M-R] @i(replace-string) @index(replace-string). 
  693. The command line responds:
  694.  
  695. "Replace []<META>:"
  696.  
  697. where the square brackets enclose the default string.  Type the word
  698. @b<electronic> and hit @b{<META>}.  The command line responds:
  699.  
  700. "with []<META>"
  701.  
  702. type @b{desktop<META>}.  EMACS replaces all instances of the original
  703. word with your revision.  Of course, you will have to captialize the
  704. first letter of "desktop" where it occurs at the beginning of a
  705. sentence.
  706.  
  707. You have just completed an @b<unconditional replace>.  In this
  708. operation, EMACS replaces every instance of the found string with the
  709. replacement string. 
  710.      
  711. @section<Query-Replace>
  712.  
  713. You may also replace text on a case by case basis.  The @b{M-^R}
  714. @i(query-replace-string) @index(query-replace-string) command causes
  715. EMACS to pause at each instance of the found string. 
  716.  
  717. For example, assume we want to replace some instances of the word
  718. "desktop" with the word "personal." Go back to the beginning of the
  719. current buffer and enter the @b(M-^R) @i(query-replace)
  720. @index(query-replace) command.  The procedure is very similar to that
  721. which you followed in the unconditional search/replace option.  When the
  722. search begins however, you will notice that EMACS pauses at each
  723. instance of "publishing" and asks whether you wish to replace it with
  724. the replacement string.  You have a number of options available for
  725. response:
  726.  
  727. @begin(verbatim)
  728. @u(    Response    Effect)
  729.     Y(es)    Make the current replacement and skip to the next
  730.         occurance of the search string
  731.  
  732.     N(o)    Do not make this replacement but continue
  733.  
  734.     !    Do the rest of the replacements with no more queries
  735.  
  736.     U(ndo)    Undo just the last replacement and query for it
  737.         again (This can only go back ONE time)
  738.  
  739.     ^G    Abort the replacement command (This action does not
  740.         undo previously-authorized replacements
  741.  
  742.     .    Same effect as ^G, but cursor returns to the point at
  743.         which the replacement command was given
  744.  
  745.     ?    This lists help for the query replacement command
  746. @end(verbatim)
  747.  
  748. Practice searching and searching and replacing until you feel
  749. comfortable with the commands and their effects.
  750. @begin(group)
  751. @heading(Chapter @value(chapter) Summary)
  752.  
  753. In this chapter, you learned how to search for specified strings of text
  754. in EMACS.  The chapter also dealt with searching for and replacing
  755. elements within a buffer. 
  756.  
  757. @begin(verbatim)
  758. @u(Key Binding        Keystroke             Effect)
  759.  
  760. Search-Forward        @b{^S}    Searches from point to end of buffer.
  761.                 Point is moved from current location to
  762.                 the end of the found string
  763.  
  764. Search-Backward        @b{^R}    Searches from point to beginning of buffer. 
  765.                 Point is moved from current location to
  766.                 beginning of found string
  767.  
  768. Replace            @b{M-R} Replace ALL ocurrences of search string with 
  769.                 specified (null) string from point to the
  770.                 end of the current buffer
  771.  
  772. Query-Replace           @b{M-^R}    As above, but pause at each found string
  773.                 and query for action
  774. @end(verbatim)
  775. @end(group)
  776. @chapter(Windows)
  777.  
  778. @section<Creating Windows>@index{Windows, Creating}
  779.  
  780. We have already met windows in an earlier chapter.  In this chapter, we
  781. will explore one of EMACS' more powerful features -- text manipulation
  782. through multiple windowing.  Windows offer you a powerful and easy way
  783. to edit text.  By manipulating a number of windows and buffers on the
  784. screen simultaneously, you can perform complete edits and revisions on
  785. the computer screen while having your draft text or original data
  786. available for reference in another window. 
  787.  
  788. You will recall that windows are areas of buffer text that you can see
  789. @index(windows) on the screen.  Because EMACS can support several screen
  790. windows simultaneously you can use them to look into different places in
  791. the same buffer.  You can also use them to look at text in different
  792. buffers.  In effect, you can edit several files at the same time. 
  793.  
  794. Let's invoke EMACS and pull back our file on desktop publishing by
  795. typing
  796.  
  797. @quotation<emacs publish.txt>
  798.  
  799. When the text appears, type the @b{^X-2} @i(split-window)
  800. @index{split-window} command.  The window splits into two windows.  The
  801. window where the cursor resides is called the @b<current> window -- in
  802. this case the bottom window.  Notice that each window has a text area
  803. and a mode line.  The @b(command line) @index{command line} is however,
  804. common to all windows on the screen. 
  805.  
  806. The two windows on your screen are virtually mirror images of each other
  807. because the new window is opened into the same buffer as the one you are
  808. in when you issue the @i{open-window command} @index{open-window}.  All
  809. commands issued to EMACS are executed on the current buffer in the
  810. current window. 
  811.  
  812. To move the cursor to the upper window (i.e., to make that window the
  813. current window, type @b{^X-P} @i(previous-window) @index{previous-window}.  
  814. Notice the cursor
  815. moves to the upper or @b<previous> window.  Entering @b{^X-O}
  816. @i(next-window) moves to the @b{next} window.  Practice moving between
  817. windows.  You will notice that you can also move into the Function Key
  818. menu by entering these commands. 
  819.  
  820. Now move to the upper window.  Let's open a new file.  On the EMACS disk
  821. is a tutorial file.  Let's call it into the upper window by typing:
  822.  
  823. @quotation<^X-^F>
  824.  
  825. and press return.
  826.  
  827. Enter the filename @b<emacs.tut>.
  828.  
  829. In a short time, the tutorial file will appear in the window.  We now have
  830. two windows on the screen, each looking into different buffers.  We have
  831. just used the @b(^X-^F) @i(find-file) @index{find-file}
  832. command to find a file and bring
  833. it into our current window.
  834.  
  835. You can scroll any window up and down with the cursor keys, or with the
  836. commands we've learned so far.    However, because the area of visible
  837. text in each window is relatively small, you can scroll the current
  838. window a line at a time.  
  839.  
  840. Type @b{^X-^N} @i(move-window-down)@index{move-window-down}
  841.  
  842. The current window scrolls down by one line -- the top line of text
  843. scrolls out of view, and the bottom line moves towards the top of the
  844. screen.  You can imagine, if you like, the whole window slowly moving
  845. down to the end of the buffer in increments of one line.  The command
  846. @b{^X-^P} @i(move-window-up)@index{move-window-up} 
  847. scrolls the window in the opposite
  848. direction. 
  849.  
  850. As we have seen, EMACS editing commands are executed in the current
  851. window, but the program does support a useful feature that allows you to
  852. scroll the @b<next> window.  
  853. @b<M-^Z> @i(scroll-next-up)@index{scroll-next-up}
  854. scrolls the next
  855. window up, @b{M-^V} @i(scroll-next-down)@index{scroll-next-down} 
  856. scrolls it downward.  From the
  857. tutorial window, practice scrolling the window with the desktop
  858. publishing text in it up and down. 
  859.  
  860. When you're finished, exit EMACS without saving any changes in your
  861. files. 
  862.  
  863.  
  864. Experiment with splitting the windows on your screen.  Open windows into
  865. different buffers and experiment with any other files you may have.  Try
  866. editing the text in each window, but
  867. don't forget to save any changes you want to keep -- you still have to
  868. save each buffer separately.
  869.  
  870. @section(Deleting Windows)@index{Windows, Deleting}
  871. Windows allow you to perform complex editing tasks with ease.  However,
  872. they become an inconvenience when your screen is cluttered with open
  873. windows you have finished using.  The simplest solution is to delete
  874. unneeded windows.  The command @b{^X-0} @i{delete-window}
  875. will delete the window you are currently working in and move you to the
  876. next window.
  877.  
  878. If you have a number of windows open, you can delete all but the current
  879. window by entering @b{^X-1} @i{delete-other-windows}.
  880.  
  881. @section(Resizing Windows)@index{Windows, Resizing} 
  882.  
  883. During complex editing tasks, you will probably find it convenient to
  884. have a number of windows on the screen simultaneously.  However this
  885. situation may present inconveniences because the more windows you have
  886. on the screen the smaller they are; in some cases, a window may show
  887. only a couple of lines of text.  To increase the flexibility and utility
  888. of the window environment, EMACS allows you to resize the window you are
  889. working in (called, as you will recall, the @b<current> window) to a
  890. convenient size for easier editing, and then shrink it when you no
  891. longer need it to be so large. 
  892.  
  893. Let's try an example.  Load in any EMACS text file and split the current
  894. window into two.  Now type @b{^X-^(Shift-6)},
  895. @i{Enlarge-window}@index{Enlarge-window}.  Your current window should be
  896. the lower one on the screen.  Notice that it increases in size upwards
  897. by one line.  If you are in the upper window, it increases in size in a
  898. downward direction.  The command @b{^X-^Z},
  899. @i{Shrink-window}@index{Shrink-window} correspondingly decreases window
  900. size by one line at a time. 
  901.  
  902. EMACS also allows you to resize a window more precisely by entering a
  903. numeric argument specifying the size of the window in lines.  To resize
  904. the window this way, press the META key and enter a numeric argument
  905. (remember to keep it smaller than the number of lines on your screen
  906. display) then press @b{^X-W} @i{Resize-window}@index{Resize-window}. 
  907. The current window will be enlarged or shrunk to the number of lines
  908. specified in the numeric argument.  For example entering:
  909.  
  910. @quotation{@b[M-8 ^X-W]}will resize the current window to 8 lines.
  911.  
  912. @section(Repositioning within a Window)
  913.  
  914. The cursor may be centered within a window by entering @b{M-! or M-^L}
  915. @i{Center-cursor} @index{Center-cursor}.  This command is especially
  916. useful in allowing you to quickly locate the cursor if you are moving
  917. frequently from window to window.  You can also use this command to move
  918. the line containing the cursor to any position within the current
  919. window.  This is done by using a numeric argument before the command.
  920. Type @b(M-<n> M-^L) where <n> is the number of the line within the
  921. window that you wish the current line to be displayed.
  922.  
  923. The @b{^L} @i{Refresh-screen} @index{refresh-screen} command is useful
  924. for 'cleaning up' a 'messy' screen that can result of using EMACS on a
  925. mainframe system and being interupted by a system message. 
  926. @newpage
  927. @u<Chapter @value(chapter) summary>
  928.  
  929. In Chapter @value(chapter) you learned how to manipulate windows and the
  930. editing flexibility they offer. 
  931.  
  932. @begin(verbatim)
  933. @u(Key Binding    Keystroke    Effect)
  934.  
  935. Open-Window    @b{^X-2}    Splits current window into two windows if
  936.                 space available
  937.  
  938. Close-Windows    @b{^X-1}    Closes all windows except current window
  939.  
  940. Next-Window    @b{^X-O}[oh]    Moves point into next (i.e. downward) window
  941.  
  942. Previous-Window @b{^XP}        Moves point to previous (i.e. upward) window
  943.  
  944. Move-Window-Down @b{^X-^N}    Scrolls current window down one line
  945.  
  946. Move-Window-Up    @b{^X-^P}    Scrolls current window up one line
  947.  
  948. Redraw-display    @b{M !} or    Window is moved so line with point
  949.         @b{M ^L}    (with cursor) is at center of window
  950.  
  951. Enlarge-Window    @b{M-X ^} or    Current window is enlarged by one
  952.         @b{M ^L}    line and nearest window is shrunk by 
  953.                 one line
  954.  
  955. Shrink-Window    @b{^X-^Z}    Current window is shrunk by one line
  956.                 and nearest window is enlarged by one line
  957.  
  958. Clear-and-redraw @b{^L}        Screen is blanked and redrawn.  Keeps
  959.                 screen updates in sync with your commands
  960.  
  961. Scroll-Next-Up    @b{M-^Z}    Scrolls next window up by one line
  962.  
  963. Scroll-Next-Down @b{M-^V}    Scrolls next window down by one line
  964.  
  965. Delete-Window    @b{^X-0}    Deletes current window
  966.  
  967. Delete-Other-Windows @b{^X-1}    Deletes all but current window
  968.  
  969. Resize-Window    @b{^X-^W}    Resizes window to a given numeric argument
  970. @end(verbatim)
  971. @chapter(Buffers)
  972.  
  973. @index(buffers) We have already learned a number of things about buffers. 
  974. As you will recall, they are the major internal entities in EMACS -- the
  975. place where editing commands are executed.  They are characterized by
  976. their @b<names>, their @b<modes>, and by the file with which they are
  977. associated.  Each buffer also "remembers" its @b(mark) and @b(point). 
  978. This convenient feature allows you to go to other buffers and return to
  979. the original location in the "current" buffer. 
  980.  
  981. Advanced users of EMACS frequently have a number of buffers in the
  982. computer's memory simultaneously.  In the last chapter, for example, you
  983. opoened at least two buffers -- one into the text you were editing, and
  984. the other into the EMACS on-line tutorial.  If you deal with complex
  985. text files -- say, sectioned chapters of a book, you may have five or
  986. six buffers in the computer's memory.  You could select different
  987. buffers by simply calling up the file with @b{^X-^F} @i(find-file)
  988. @index(find-file), and let EMACS open or reopen the buffer.  However,
  989. EMACS offers fast and sophisticated buffering techniques that you will
  990. find easy to master and much more convenient to use. 
  991.  
  992. Let's begin by opening three buffers.  You can open any three you
  993. choose, for example call the following files into memory: @b(fang.txt),
  994. @b(publish.txt), and @b(emacs.tut) in the order listed here.  When
  995. you've finished this process, you'll be looking at a screen showing the
  996. EMACS tutorial.  Let's assume that you want to move to the fang.txt
  997. buffer.  Enter:
  998.  
  999. @b{^X-X} @i(next-buffer) @index(next-buffer)
  1000.  
  1001. This command moves you to the @u<next> buffer.  Because EMACS cycles
  1002. through the buffer list, which is alphabetized, you will now be in the
  1003. @b(fang.txt) buffer. Using @b(^X-X) again places you in the
  1004. @b(publish.txt) buffer. @i(If you are on a machine that supports
  1005. function keys, using @b[^X-X] again places you in the @b(Function Keys)
  1006. buffer). Using @b(^X-X) one last time cycles you back to the beginning
  1007. of the list.
  1008.  
  1009. If you have a large number of buffers to deal with, this cycling process
  1010. may be slow and inconvenient.  The command @b{^X-B} @i(select-buffer)
  1011. @index(select-buffer) allows you to specify the buffer you wish to be
  1012. switched to.  When the command is entered, EMACS prompts, "Use buffer:". 
  1013. Simply enter the buffer name (NOT the file name), and that buffer will
  1014. then become the current buffer. 
  1015.  
  1016. Multiple buffer manipulation and editing is a complex activity, and you
  1017. will probably find it very inconvenient to re-save each buffer as you
  1018. modify it.  The command @b{^X-^B} @i(list-buffers) @index(list-buffers)
  1019. creates a new window that gives details about all the buffers currently
  1020. known to EMACS.  Buffers that have been modified are identified by the
  1021. "buffer changed" indicator (an asterisk in the second column).  You can
  1022. thus quickly and easily identify buffers that need to be saved to files
  1023. before you exit EMACS.  The buffer window also provides other
  1024. information -- buffer specific modes, buffer size, and buffer name are
  1025. also listed.  To close this window, simply type the close-windows
  1026. command, @b{^X-1}. 
  1027.  
  1028. To delete any buffer, type @b{^X-K} @i(delete-buffer)
  1029. @index(delete-buffer).  EMACS prompts you "Kill buffer:".  Enter the
  1030. buffer name you want to delete.  As this is destructive command, EMACS
  1031. will ask for confirmation if the buffer was changed and not saved. 
  1032. Answer Y(es) or N(o).  As usual @b{^G} cancels the command. 
  1033.  
  1034. @newpage
  1035. @heading(Chapter @value(chapter) Summary)
  1036.  
  1037. In Chapter @value(chapter) you learned how to manipulate buffers. 
  1038.  
  1039. @begin{verbatim}
  1040. @u(Key Binding        Keystroke               Effect)
  1041. Next-Buffer        @b(^X-^X)    Switch to the next buffer in the
  1042.                     buffer list
  1043.  
  1044. Select-Buffer        @b(^X-B)    Switch to a particular buffer
  1045.  
  1046. List-Buffers        @b(^X-^B)    List all buffers
  1047.  
  1048. Delete-Buffer        @b(^X-K)    delete a particular buffer if it
  1049.                     is off-screen
  1050. @end(verbatim)
  1051. @chapter(Modes)
  1052.  
  1053.     EMACS allows you to change the way it works in order to
  1054. customized it to the style of editing you are using.  It does this by
  1055. providing a number of different @b(modes) @index(modes).  These modes
  1056. can effect either a single buffer, or any new buffer that is created. 
  1057. To add a mode to the current buffer, type @b(^X-M) @i(add-mode)
  1058. @index(add-mode).  EMACS will then prompt you for the name of a mode to
  1059. add.  When you type in a legal mode name, and type a <NL>, EMACS will
  1060. add the mode name to the list of current mode names in the modeline of
  1061. the current buffer. 
  1062.  
  1063.     To remove an existing mode, typing the @b(^X-^M) @i(delete-mode)
  1064. @index(delete-mode) will cause EMACS to prompt you for the name of a
  1065. mode to delete from the current buffer.  This will remove that mode from
  1066. the mode list on the current modeline.
  1067.  
  1068.     Global modes are the modes which are inherited by any new
  1069. buffers which are created.  For example, if you wish to always do string
  1070. searching with character case being significant, you would want global
  1071. mode EXACT to be set so that any new files read in inherent the EXACT
  1072. mode.  Global modes are set with the @b(M-M) @i(add-global-mode)
  1073. @index(add-global-mode) command, and unset with the @b(M-^M)
  1074. @i(delete-global-mode) @index(delete-global-mode) command.  Also, the
  1075. current global modes are displayed in the first line of a
  1076. @b(^X-^B) @i(list-buffers) @index(list-buffers) command.
  1077.  
  1078.     On machines which are capable of displaying colors,
  1079. @index(color) the mode commands can also set the background and
  1080. forground character colors.  Using @i(add-mode) or @i(delete-mode) with
  1081. a lowercase color will set the background color in the current window. 
  1082. An uppercase color will set the forground color in the current window. 
  1083. Colors that EMACS knows about are: white, cyan, magenta, yellow, blue,
  1084. red, green, and black.  If the computer you are running on does not have
  1085. eight colors, EMACS will attempt to make some intellegent guess at what
  1086. color to use when you ask for one which is not there. 
  1087.  
  1088. @section(ASAVE mode)
  1089.  
  1090.     Automatic Save mode tells EMACS to automatically write out the
  1091. current buffer to its associated file on a regular basis.  Normally this
  1092. will be every 256 characters typed into the file.  The environment
  1093. variable $ACOUNT counts down to the next auto-save, and $ASAVE is the
  1094. value used to reset $ACOUNT after a save occurs. 
  1095.  
  1096. @section(CMODE mode)
  1097.  
  1098.     CMODE is useful to C programmers.  When CMODE is active, EMACS
  1099. will try to assist the user in a number of ways.  This mode is set
  1100. automatically with files that have a .c or .h extension. 
  1101.  
  1102.     The <NL> key will normally attempt to return the user to the next
  1103. line at the same level of indentation as the current line, unless the
  1104. current line ends with a open brace ({) in which case the new line will
  1105. be further indented by one tab position.
  1106.  
  1107.     A close brace (}) will delete one tab position preceeding itself
  1108. as it is typed.  This should line up the close brace with its matching
  1109. IF, FOR or WHILE statement. 
  1110.  
  1111.     A pound sign (#) with only leading whitespace will delete all
  1112. the whitespace preceeding itself. This will always bring preprocessor
  1113. directives flush to the left margin.
  1114.  
  1115.     Whenever any close fence is typed, ie )]>}, if the matching open
  1116. fence is on screen in the current window, the cursor will breifly flash
  1117. to it, and then back. This makes balencing expresions, and matching
  1118. blocks much easier.
  1119.  
  1120. @section(CRYPT mode)
  1121.  
  1122.     When a buffer is in CRYPT mode, @index(encryption) it is
  1123. encrypted whenever it is written to a file, and decrypted when it is
  1124. read from the file.  The encryption key can be specified on the command
  1125. line with the -k switch, or with the @b(M-E) @i(set-encryption-key)
  1126. @index(set-encryption-key) command.  If you attempt to read or write a
  1127. buffer in crypt mode and now key has not been set, EMACS will execute
  1128. @i(set-encryption-key) automatically, prompting you for the needed key. 
  1129. Whenever EMACS prompts you for a key, it will not echo the key to your
  1130. screen as you type it (ie make SURE you get it right when you set it
  1131. originally).
  1132.  
  1133.     The encryption algorithm used changes all characters into normal
  1134. printing characters, thus the resulting file is suitable for sending via
  1135. electronic mail.  All version of MicroEMACS should be able decrypt the
  1136. resulting file regardless of what machine encrypted it.  Also available
  1137. with EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
  1138. the files produced by CRYPT mode in EMACS.
  1139.  
  1140. @section(EXACT mode)
  1141.  
  1142.     All string searches and replacements will take upper/lower case
  1143. into account. Normally the case of a string during a search or replace
  1144. is not taken into account.
  1145.  
  1146. @section(MAGIC mode)
  1147.  
  1148.      In the MAGIC mode certain characters gain special meanings when
  1149. used in a search pattern.  Collectively they are know as regular
  1150. expressions, and a limited number of them are supported in MicroEmacs. 
  1151. They grant greater flexability when using the search command.  However,
  1152. they do not affect the incremental search command. 
  1153.  
  1154.      The symbols that have special meaning in MAGIC mode are
  1155. ^, $, ., *, [ (and ], used with it), and \.
  1156.  
  1157.      The characters ^ and $ fix the search pattern to the beginning and
  1158. end of line, respectively.  The ^ character must appear at the beginning
  1159. of the search string, and the $ must appear at the end, otherwise they
  1160. loose their meaning and are treated just like any other character.  For
  1161. example, in MAGIC mode, searching for the pattern "t$" would put the
  1162. cursor at the end of any line that ended with the letter 't'.  Note that
  1163. this is different than searching for "t<NL>", that is, 't' followed by a
  1164. newline character.  The character $ (and ^, for that matter) matches a
  1165. position, not a character, so the cursor remains at the end of the line. 
  1166. But a newline is a character that must be matched, just like any other
  1167. character, which means that the cursor is placed just after it - on the
  1168. beginning of the next line. 
  1169.  
  1170.      The character .  has a very simple meaning -- it matches any single
  1171. character, except the newline.  Thus a search for "bad.er" could match
  1172. "badger", "badder" (slang), or up to the 'r' of "bad error". 
  1173.  
  1174.      The character * is known as closure, and means that zero or more of
  1175. the preceding character will match.  If there is no character preceding,
  1176. * has no special meaning, and since it will not match with a newline, *
  1177. will have no special meaning if preceded by the beginning of line symbol
  1178. ^ or the literal newline character <NL>. 
  1179.  
  1180.      The notion of zero or more characters is important.  If, for
  1181. example, your cursor was on the line
  1182.  
  1183. @quotation(This line is missing two vowels.)
  1184.  
  1185. and a search was made for "a*", the cursor would not move, because it is
  1186. guarenteed to match no letter 'a' , which satifies the search
  1187. conditions.  If you wanted to search for one or more of the letter 'a',
  1188. you would search for "aa*", which would match the letter a, then zero or
  1189. more of them. 
  1190.  
  1191.      The character [ indicates the beginning of a character class.  It
  1192. is similar to the 'any' character ., but you get to choose which
  1193. characters you want to match.  The character class is ended with the
  1194. character ].  So, while a search for "ba.e" will match "bane", "bade",
  1195. "bale", "bate", et cetera, you can limit it to matching "babe" and
  1196. "bake" by searching for "ba[bk]e".  Only one of the characters inside
  1197. the [ and ] will match a character.  If in fact you want to match any
  1198. character except those in the character class, you can put a ^ as the
  1199. first character.  It must be the first character of the class, or else
  1200. it has no special meaning.  So, a search for [^aeiou] will match any
  1201. character except a vowel, but a search for [aeiou^] will match any vowel
  1202. or a ^.
  1203.  
  1204. If you have a lot of characters in order that you want to put in the
  1205. character class, you may use a dash (-) as a range character.  So, [a-z]
  1206. will match any letter (or any lower case letter if EXACT mode is on),
  1207. and [0-9a-f] will match any digit or any letter 'a' through 'f', which
  1208. happen to be the characters for hexadecimal numbers.  If the dash is at
  1209. the beginning or end of a character class, it is taken to be just a
  1210. dash. 
  1211.  
  1212.      The escape character \ is for those times when you want to be in
  1213. MAGIC mode, but also want to use a regular expression character
  1214. to be just a character.  It turns off the special meaning of the
  1215. character.  So a search for "it\." will search for a line with "it.",
  1216. and not "it" followed by any other character.  The escape character
  1217. will also let you put ^, -, or ] inside a character class with no
  1218. special side effects.
  1219.  
  1220. @section(OVER mode)
  1221.  
  1222.     OVER mode stands for overwrite mode.  When in this mode, when
  1223. characters are typed, instead of simply inserting them into the file,
  1224. EMACS will attempt to overwrite an existing character past the point. 
  1225. This is very useful for adjusting tables and diagrams. 
  1226.  
  1227. @section(WRAP mode)
  1228.  
  1229.     Wrap mode is used when typing in continuous text.  Whenever the
  1230. cursor is past the currently set fill column @index(fill column) (72 by
  1231. default) and the user types a space or a <NL>, the last word of the line
  1232. is brought down to the beginning of the next line.  Using this, one just
  1233. types a continous stream of words and EMACS automatically inserts <NL>s
  1234. at appropriate places.
  1235.  
  1236. @center(NOTE to programmers:)
  1237.  
  1238. @quotation{EMACS actually calls up the function bound to the illegal
  1239. keystroke M-FNW.  This is bound to the function @i(wrap-word)
  1240. @index(wrap-word) by default, but can be re-bound to activate different
  1241. functions and macros at wrap time.}
  1242.  
  1243. @section(VIEW mode)
  1244.  
  1245.     VIEW mode disables all commands which can change the current
  1246. buffer.  EMACS will display an error message and ring the bell every
  1247. time you attempt to change a buffer in VIEW mode.
  1248. @newpage
  1249. @heading(Chapter @value(chapter) Summary)
  1250.  
  1251. In Chapter @value(chapter) you learned about modes and their effects.
  1252.  
  1253. @begin{verbatim}
  1254. @u(Key Binding        Keystroke               Effect)
  1255. Add-Mode        @b(^X-M)    Add a mode to the current buffer
  1256.  
  1257. Delete-Mode        @b(^X-^M)    Delete a mode from the current buffer
  1258.  
  1259. Add-Global-Mode        @b(M-M)        Add a global mode to the
  1260.                     current buffer
  1261.  
  1262. Delete-Global-Mode    @b(M-^M)    Delete a global mode from the
  1263.                     current buffer
  1264. @end(verbatim)
  1265. @chapter(Files)
  1266.  
  1267. A file is simply a collection of related data.  In EMACS we are dealing
  1268. with text files -- named collections of text residing on a disk (or some
  1269. other storage medium).  You will recall that the major entities EMACS
  1270. deals with are buffers.  Disk-based versions of files are only active in
  1271. EMACS when you are reading into or writing out of buffers.  As we have
  1272. already seen, buffers and physical files are linked by associated
  1273. filenames.  For example, the buffer "ch7.txt" which is associated with
  1274. the physical disk file "ch7.txt." You will notice that the file is
  1275. usually specified by the drive name or (in the case of a hard drive) a
  1276. path.  Thus you can specify full filenames in EMACS,
  1277.  
  1278. e.g. disk:\directories\filename.extension
  1279.  
  1280. If you do not specify a disk and directories, the default disk is used.
  1281.  
  1282. IMPORTANT -- If you do not explicitly save your buffer to a file, all your
  1283. edits will be lost when you leave EMACS (although EMACS will prompt you
  1284. when you are about to lose edits by exiting).  In addition, EMACS does
  1285. not protect your disk-based files from overwriting when it saves files. 
  1286. Thus when you instruct EMACS to save a file to disk, it will create a
  1287. file if the specified file doesn't exist, or it will overwrite the
  1288. previously saved version of the file thus replacing it.  Your old
  1289. version is gone forever. 
  1290.  
  1291. If you are at all unsure about your edits, or if (for any reason) you
  1292. wish to keep previous versions of a file, you can change the name of the
  1293. associated file with the command @b{^X-N}.  When this file is saved
  1294. to disk, EMACS will create a new physical file under the new name.  The
  1295. earlier disk file will be preserved.
  1296.  
  1297. For example, let's load the file @b{fang.txt} into EMACS.  Now, type
  1298. @b{^X-N}.  The EMACS command line prompts "name:".  Enter a new name
  1299. for the file -- say @b(new.txt) and press <NL>.  The file will be
  1300. saved under the new filename, and your disk directory will show both
  1301. @b(fang.txt) and @b(new.txt).
  1302.  
  1303. An alternative method is to write the file directly to disk under a new
  1304. filename.  Let's pull our "publish.txt" file into EMACS.  To write this
  1305. file under another filename, type @b{^X-^W}.  EMACS will prompt
  1306. you "write file:".  Enter an alternate filename -- @b{desktop.txt}. 
  1307. Your file will be saved as the physical file "desktop.txt".
  1308.  
  1309. Note that in the examples above, although you have changed the names of
  1310. the related files, the buffer names remain the same.  However, when you
  1311. pull the physical file back into EMACS, you will find that the buffer
  1312. name now relates to the filename.
  1313.  
  1314. For example -- You are working with a buffer "fang.txt" with the related
  1315. file "fang.txt".  You change the name of the file to "new.txt".  EMACS
  1316. now shows you working with the buffer "fang.txt" and the related file
  1317. "new.txt".  Now pull the file "new.txt" into EMACS.  Notice that the
  1318. buffer name has now changed to "new.txt". 
  1319.  
  1320. If for any reason a conflict of buffer names occurs,(if you have files
  1321. of the same name on different drives for example) EMACS will prompt
  1322. you "use buffer:".  Enter an alternative buffer name if you need to. 
  1323.  
  1324. For a list of file related commands (including some we`ve already
  1325. seen), see the summary page.
  1326. @newpage
  1327. @heading(Chapter @value(chapter) Summary)
  1328.  
  1329. In Chapter @value(chapter) you learned some of the more advanced
  1330. concepts of file naming and manipulation.  The relationship between
  1331. files and buffers was discussed in some detail. 
  1332.  
  1333. @begin(verbatim)
  1334. @u(Key Binding    Keystroke    Effect)
  1335.  
  1336. Save-file    @b{^X-^S}    Saves contents of current buffer with
  1337.                 associated filename on default disk/
  1338.                 directory (if not specified)
  1339.  
  1340. Write-File    @b{^X-^W}    Current buffer contents will be
  1341.                 saved under specified name 
  1342.  
  1343. Change-File-name
  1344.         @b{^X-N}    The associated filename is changed
  1345.                 (or associated if not previously
  1346.                 specified) as specified
  1347.  
  1348. Find-File    @b{^X-^F}    Reads specified file into buffer and 
  1349.                 switches you to that buffer, or switches
  1350.                 to buffer in which the file has previously
  1351.                 been read
  1352.  
  1353. Read-File    @b{^X-^R}    Reads file into buffer thus overwriting
  1354.                 buffer contents.  If file has already
  1355.                 been read into another buffer, you will
  1356.                 be switched to it
  1357.  
  1358. View-File    @b{^X-^V}    The same as read-file except the buffer
  1359.                 is automatically put into VIEW mode thus 
  1360.                 preventing any changes from being made
  1361. @end{verbatim}
  1362. @chapter(Screen Formatting)
  1363.  
  1364. @section<Wrapping Text>
  1365.  
  1366. As we learned in the introduction, EMACS is not a word processor, but an
  1367. editor.  Some simple formatting options are available however, although
  1368. in most cases they will not affect the appearence of the finished text
  1369. @index(wrapping text) when it is run through the formatter.  We have
  1370. already encountered WRAP mode which wraps lines longer than a certain
  1371. length (default is 75 characters).  You will recall that WRAP is enabled
  1372. by entering @b{^X-M} and responding to the command line prompt with
  1373. @b{wrap}. 
  1374.  
  1375. You can also set your own wrap margin with the command @b{^X-F}
  1376. @i(set-fill-column) @index(set-fill-column).  Notice EMACS responds
  1377. "[Fill column is 1]." Now try typing some text.  You'll notice some very
  1378. strange things happening -- your text wraps at every word!! This effect
  1379. occurs because the set wrap margin command must be preceeded by a
  1380. numeric argument or EMACS sets it to the first column.  Thus any text
  1381. you type that extends past the first column will wrap at the most
  1382. convenient line break. 
  1383.  
  1384. To reset the wrap column to 72 characters, press the @b{<META>} key and
  1385. enter 72.  EMACS will respond "Arg: 72".  Now press @b<^X-F>.  EMACS
  1386. will respond "[Fill column is 72]".  Your text will again wrap at the
  1387. margin you've been using up to this point.
  1388.  
  1389. @section<Reformatting Paragraphs>
  1390.  
  1391. After an intensive editing session, you may find that you have
  1392. paragraphs containing lines of differing lengths.  Although this
  1393. disparity will not affect the formatted text, aesthetic and technical
  1394. concerns may make it desirable to have consistent paragraph blocks on
  1395. the screen.  If you are in WRAP mode, you can reformat a paragraph with
  1396. the command @b{M-Q} @i(fill-paragraph) @index(fill-paragraph).  This
  1397. command 'fills' the current paragraph reformatting it so all the lines
  1398. are filled and wrap logically.  The process is complex, and (especially
  1399. with longer paragraphs) may take a little time. 
  1400.  
  1401. @section<Changing Case>
  1402.  
  1403. There may be occasions when you find it necessary to change the case of
  1404. the text you've entered.  EMACS allows you to change the case of even
  1405. large amounts of text with ease.  Let's try and convert a few of the
  1406. office traditionalists to the joy of word processing.  Type in the
  1407. following text:
  1408.  
  1409. @quotation{Throw away your typewriter and learn to use a word processor. 
  1410. Word processing is relatively easy to learn and will increase your
  1411. productivity enormously.  Enter the Computer Age and find out just how
  1412. much fun it can be!!}
  1413.  
  1414. Let's give it a little more impact by capitalizing the first four words. 
  1415. The first step is to define the region of text just as you would if you
  1416. were doing an extensive deletion.  Set the mark at the beginning of the
  1417. paragraph with @b{M-<space>} @i(set-mark) and move the cursor to the
  1418. space beyond "typewriter." Now enter @b{^X-^U} @i(case-region-upper). 
  1419. Your text should now look like this:
  1420.  
  1421. @quotation{THROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
  1422. Word processing is relatively easy to learn and will increase your
  1423. productivity enormously.  Enter the Computer Age and find out just how
  1424. much fun it can be!!}
  1425.  
  1426. If you want to change the text back to lower case, type @b{^X-^L}
  1427. @i(case-region-lower) @index(case-region-lower).  You can also
  1428. capitalize individual words.  To capitalize the word "fun", position the
  1429. cursor in front of the word and type @b{M-U} @i(case-word-upper)
  1430. @index(case-word-upper).  The word is now capitalized.  To change it
  1431. back to lower case, move the cursor back to the beginning of the word
  1432. and type @b{M-L} @i(case-word-lower) @index(case-word-lower). 
  1433.  
  1434. You may also capitalize individual letters in EMACS.  The command
  1435. @b{M-C} @i(case-word-capitalize) @index(case-word-capitalize)
  1436. capitalizes the first letter after the point.  This command would
  1437. normally be issued with the cursor positioned in front of the first
  1438. letter of the word you wish to capitalize.  If you issue it in the
  1439. middle of a word, you can end up with some strAnge looking text. 
  1440.  
  1441. @section<Tabs>
  1442.  
  1443. Unless your formatter is instructed to take screen text literally (as
  1444. MicroSCRIBE does in the 'verbatim' environment for example), tabs in
  1445. EMACS generally affect screen formatting only. 
  1446.  
  1447. When EMACS is first started, it sets the default tab to every eighth
  1448. column.  As long as you stay with default, every time you press the tab
  1449. key a tab character, @b(^I) is inserted.  This character, like other
  1450. control characters, is invisible -- but it makes a subtle and
  1451. significant difference to your file and editing. 
  1452.  
  1453. For example, in default mode, press the tab key and then type the word
  1454. @b{Test}.  "Test" appears at the eighth column.  Move your cursor to the
  1455. beginning of the word and delete the backward character.  The word
  1456. doesn't move back just one character, but flushes to the left margin. 
  1457. The reason for this behavior is easily explained.  In tab default, EMACS
  1458. inserts a 'real' tab character when you press the tab key.  This
  1459. character is inserted at the default position, but NO SPACES are
  1460. inserted between the tab character and the margin (or previous tab
  1461. character).  As you will recall, EMACS only recognizes characters (such
  1462. as spaces or letters) and thus when the tab character is removed, the
  1463. text beyond the tab is flushed back to the margin or previous tab mark.
  1464.  
  1465. This situation changes if you alter the default configuration.  The
  1466. default value may be changed by entering a numeric argument before
  1467. pressing the tab key.  As we saw earlier, pressing the @b{META} key and
  1468. entering a number allows you to specify how EMACS performs a given
  1469. action.  In this case, let's specify an argument of 10 and hit the tab
  1470. key. 
  1471.  
  1472. Now hit the tab key again and type @b{Test}.  Notice the word now
  1473. appears at the tenth column.  Now move to the beginning of the word and
  1474. delete the backward character.    "Test" moves back by one character. 
  1475.  
  1476. EMACS behaves differently in these circumstances because the @b(^I)
  1477. @index(tab handling) @i(handle-tab) @index(handle-tab) function deals
  1478. with tabbing in two distinct ways.  In default conditions, or if the
  1479. numeric argument of zero is used, @i(handle-tab) inserts a true tab
  1480. character.  If, however, a non-zero numeric argument is specified,
  1481. @i(handle-tab) inserts the correct number of spaces needed to position
  1482. the cursor at the next specified tab position.  It does NOT insert the
  1483. single tab character and hence any editing functions should take account
  1484. of the number of spaces between tabbed columns. 
  1485.  
  1486. Many times you would like to take a line which has been created using
  1487. the tab character and change it to use just spaces.  The command
  1488. @b(^X-^D) @i(detab-line) @index(detab-line) changes any tabs from the
  1489. point to the end of the current line into the right number of spaces so
  1490. the line does not change.  This is very usefull for times when the file
  1491. must be printed or transfered to a machine which does not understand
  1492. tabs. 
  1493.  
  1494. Also, the inverse command, @b(^X-^E) @i(entab-lines) @index(entab-lines)
  1495. changes multiple spaces to tabs where possible.  This is a good way to
  1496. shrink the size of large documents, escpecially with data tables.  Both
  1497. of these commands can take a numeric argument which will be interpeted
  1498. as the number of lines to en/detab. 
  1499. @newpage
  1500. @heading(Chapter @value(chapter) Summary)
  1501.  
  1502. In Chapter @value(chapter) introduced some of the formatting features of
  1503. EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
  1504. some detail.  The commands in the following table were covered in the
  1505. chapter. 
  1506.  
  1507. @begin{verbatim}
  1508.  
  1509. @u(Key Binding        Keystroke            Effect)
  1510. Add-Mode/WRAP        @b{^X-M}[WRAP]    Add wrap mode to current buffer
  1511.  
  1512. Delete-Mode/WRAP    @b{^X-^M}[WRAP]    Remove wrap mode from current buffer
  1513.  
  1514. Set-Fill-Column        @b{^X-F}     Set fill column to given numeric
  1515.                     argument  
  1516.  
  1517. Fill-Paragraph        @b{M-Q}        Logically reformats the current
  1518.                     paragraph
  1519.  
  1520. Case-Word-Upper     @b{M-U}        Text from point to end of the
  1521.                     current word is changed to uppercase
  1522.  
  1523. Case-Word-Lower     @b{M-L}        Text from point to end of the 
  1524.                     current word is changed to lowercase
  1525.  
  1526. Case-Word-Capitalize    @b{M-C}        First word (or letter) after the
  1527.                     point is capitalized
  1528.  
  1529. Case-Region-Upper    @b{^X-^U}    The current region is uppercased
  1530.  
  1531. Case-Region-Lower    @b{^X-^L}    The current region is lowercased
  1532.  
  1533. Handle-Tab        @b{^I}        Tab interval is set to the given
  1534.                     numeric argument
  1535. Entab-Line        @b(^X-^E)    Changes multiple spaces to tabs
  1536.                     characters where possible
  1537. Detab-Line        @b(^X-^D)    Changes tab characters to the
  1538.                     apprpriate number of spaces
  1539. @end{verbatim}
  1540. @chapter(Keyboard Macros)
  1541.  
  1542. In many applications, it may be necessary to repeat a series of
  1543. characters or commands frequently.  For example, a paper may require the
  1544. frequent repetition of a complex formula or a long name.  You may also
  1545. have a series of EMACS commands that you invoke frequently.  Keyboard
  1546. macros offer a convenient method of recording and repeating these
  1547. commands. 
  1548.  
  1549. Imagine, for example, you are writing a scholarly paper on @i{Asplenium
  1550. platyneuron}, the spleenwort fern.  Even the dedicated botanist would
  1551. probably find it a task bordering on the agonizing to type
  1552. @i{Asplenium platyneuron} frequently throughout the paper.  An
  1553. alternative method is 'record' the name in a keyboard macro.  Try it
  1554. yourself.
  1555.  
  1556. The command @b{^X-(} @i(begin-macro) @index(begin-macro) starts
  1557. recording the all the keystrokes and commands you input.  After you've
  1558. typed it, enter @b{Asplenium platyneuron}.  To stop recording, type
  1559. @b{^X-)} @i(end-macro) @index(end-macro).  EMACS has stored all the
  1560. keystrokes between the two commands.  To repeat the name you've stored,
  1561. just enter @b{^X-E} @i(execute-macro) @index(execute-macro), and the
  1562. name "Asplenium platyneuron" appears.  You can repeat this action as
  1563. often as you want, and of course as with any EMACS command, you may
  1564. preceed it with a numerical argument. 
  1565.  
  1566. Because EMACS records keystrokes, you may freely intermix commands and
  1567. text.  Unfortunately, you can only store one macro at a time.  Thus, if
  1568. you begin to record another macro, the previously defined macro is
  1569. lost. Be careful to ensure that you've finished with one macro before
  1570. defining another.  If you have a series of commands that you would like
  1571. to 'record' for future use, use the macro or procedure facilities
  1572. detailed in chapter <X>.
  1573. @newpage
  1574. @heading(Chapter @value(chapter) Summary)
  1575.  
  1576. Chapter @value(chapter) covered keyboard macros.  You learned how to
  1577. record keystrokes and how to repeat the stored sequence. 
  1578.  
  1579. @begin{verbatim}
  1580. @u(Key Binding        Keystroke        Effect)
  1581.  
  1582. Start-Macro        @b{^X-(}    Starts recording all keyboard input
  1583.  
  1584. End-Macro        @b{^X-)}    Stops recording keystrokes for macro
  1585.  
  1586. Execute-Macro        @b{^X-E}    Entire sequence of recorded
  1587.                     keystrokes is replayed
  1588. @end{verbatim}
  1589. @chapter(MicroEMACS Macros)
  1590.  
  1591.     Macros are programs that are used to customize the editor and to
  1592. perform complicated editing tasks.  They may be stored in files or
  1593. buffers and may be executed using an appropriate command, or bound to a
  1594. particular keystroke.  Portions of the standard start-up file are
  1595. impliment via macros, as well as the example menu system.  The
  1596. @i(execute-macro-<n>) @index(execute-macro-<n>) commands cause the
  1597. macro, numbered from 1 to 40, to be executed.  The @i(execute-file)
  1598. @index(execute-file) command allows you to execute a macro stored in a
  1599. disk file, and the @i(execute-buffer) @index(execute-buffer) command
  1600. allows you to execute a macro stored in a buffer.  Macros are stored for
  1601. easy execution by executing files that contain the store-macro command. 
  1602.  
  1603.     There are many different aspects to the macro langage within
  1604. MicroEMACS.  Editor commands are the various commands that manipulate
  1605. text, buffers, windows, etc, within the editor.  Directives are commands
  1606. which control what lines get executed within a macro.  Also there are
  1607. various types of variables.  Environmental variables both control and
  1608. report on different aspects of the editor.  User variables hold string
  1609. values which may be changed and inspected.  Buffer variables allow text
  1610. to be placed into variables.  Interactive variable allow the program to
  1611. prompt the user for information.  Functions can be used to manipulate
  1612. all these variables. 
  1613.  
  1614. @section(Variables)
  1615.  
  1616.     Variables in MicroEMACS can be used to return values within
  1617. expressions, as repeat counts to editing commands, or as text to be
  1618. inserted into buffers and messages.  The value of these variables is set
  1619. using the set (^X-A) command.  For example, to set the current fill
  1620. column to 64 characters, the following macro line would be used:
  1621.  
  1622.     set $fillcol 64
  1623.  
  1624.     or to have the contents of @b(%name) inserted at the point in the
  1625. current buffer, the command to use would be:
  1626.  
  1627.     insert-string %name
  1628. @newpage
  1629. @subsection(Environmental Variables)
  1630.  
  1631.     "What good is a quote if you can't change it?"
  1632.  
  1633.     These variables are used to change different aspects of the way
  1634. the editor works.  Also they will return the current settings if used as
  1635. part of an expresion.  All environmental variable names begin with a
  1636. dollar sign ($) and are in lower case.
  1637.  
  1638. @begin(description)
  1639. $acount@\The coundown of inserted characters until the next save-file.
  1640.  
  1641. $asave@\The number of inserted characters between automatic file-saves
  1642. in ASAVE mode. 
  1643.  
  1644. $cbufname@\Name of the current buffer
  1645.  
  1646. $cfname@\File name of the current buffer
  1647.  
  1648. $cmode@\Integer containing the mode of the current buffer. (See Appendix E
  1649. for values)
  1650.  
  1651. $curchar@\Character currently at the point
  1652.  
  1653. $curcol@\Current column of point in current buffer
  1654.  
  1655. $curline@\Current line of point in current buffer
  1656.  
  1657. $curwidth@\Number of columns used currently
  1658.  
  1659. $cwline@\Current display line in current window
  1660.  
  1661. $debug@\Flag to trigger macro debugging (try it... you'll like it!)
  1662.  
  1663. $discmd@\Flag to disable the echoing of messages on the command line
  1664.  
  1665. $disinp@\Flag to disable the echoing of characters during command line input
  1666.  
  1667. $fillcol@\Current fill column
  1668.  
  1669. $flicker@\Flicker Flag set to TRUE if IBM CGA set to FALSE for most others
  1670.  
  1671. $gmode@\Global mode flags. (See Appendix E for values)
  1672.  
  1673. $lastkey@\[READ ONLY]Last keyboard character typed
  1674.  
  1675. $lwidth@\[READ ONLY]Returns the number of characters in the current line
  1676.  
  1677. $match@\[READ ONLY]Last string matched in a magic mode search
  1678.  
  1679. $pagelen@\Number of screen lines used currently
  1680.  
  1681. $palette@\string used to control the palette register settings on
  1682. graphics versions.  The usually form consists of groups of three octal
  1683. digits setting the red, green, and blue levels. 
  1684.  
  1685. $progname@\[READ ONLY]Always contains the string "MicroEMACS" for
  1686. standard MicroEMACS.  Could be something else if used as part of someone
  1687. else's program
  1688.  
  1689. $replace@\Current default replace string
  1690.  
  1691. $search@\Current default search string
  1692.  
  1693. $seed@\Integer seed of the random number generator
  1694.  
  1695. $sres@\Current screen resolution (CGA, MONO or EGA on the IBM-PC driver. 
  1696. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040, NORMAL on all others)
  1697.  
  1698. $status@\[READ ONLY]Status of the success of the last command (TRUE or
  1699. FALSE).  This is usually used with !force to check on the success of a
  1700. search, or a file operation. 
  1701.  
  1702. $target@\Current target for line moves (setting this fool's EMACS into
  1703. believing the last command was a line move)
  1704.  
  1705. $tpause@\Controls the length of the pause to display a matched fence
  1706. when the current buffer is in CMODE and a close fence has been typed
  1707.  
  1708. $version@\[READ ONLY]Contains the current MicroEMACS version number
  1709.  
  1710. $wline@\Number of display lines in current window
  1711. @end(description)
  1712.  
  1713.     Obviously, many more of these variables will be availible in
  1714. future releases of MicroEMACS. (Yes, send a vote for your favorite new
  1715. environmental variables today).
  1716.  
  1717. @subsection(User variables)
  1718.  
  1719.     User variables allow you, the user, to store strings and
  1720. manipulate them.  These strings can be pieces of text, numbers (in text
  1721. form), or the logical values @b(TRUE) and @b(FALSE).  These variables
  1722. can be combined, tested, inserted into buffers, and otherwise used to
  1723. control the way your macros execute.  At the moment, up to 100 user
  1724. variables may be in use in one editing session.  All users variable
  1725. names must begin with a percent sign (%) and may contain any printing
  1726. characters.  Only the first 10 characters are significant (ie
  1727. differences beyond the tenth character are ignored).  Most operators
  1728. will truncate strings to a length of 128 characters. 
  1729.  
  1730. @subsection(Buffer Variables)
  1731.  
  1732.     Buffer variables are special in that they can only be queried
  1733. and cannot be set.  What buffer variables are is a way to take text from
  1734. a buffer and place it in a variable. For example, if I have a buffer by
  1735. the name of RIGEL2, and it contains the text:
  1736.  
  1737. @begin(verbatim)
  1738. @begin(group)
  1739.     Richmond
  1740.     Lafayette
  1741.     <*>Bloomington        (where <*> is the current point)
  1742.     Indianapolis
  1743.     Gary
  1744.     =* MicroEMACS 3.9 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  1745. @end(group)
  1746. @end(verbatim)
  1747.  
  1748.     and within a command I reference #rigel2, like:
  1749.  
  1750.     insert-string #rigel2
  1751.  
  1752.     MicroEMACS would start at the current point in the RIGEL2
  1753. buffer and grab all the text up to the end of that line and pass that
  1754. back.  Then it would advance the point to the beginning of the next line.
  1755. Thus, after our last command executes, the string "Bloomington" gets
  1756. inserted into the current buffer, and the buffer RIGEL2 now looks like
  1757. this:
  1758.  
  1759. @begin(verbatim)
  1760. @begin(group)
  1761.     Richmond
  1762.     Lafayette
  1763.     Bloomington
  1764.     <*>Indianapolis        (where <*> is the current point)
  1765.     Gary
  1766.     =* MicroEMACS 3.9 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  1767. @end(group)
  1768. @end(verbatim)
  1769.  
  1770.     as you have probably noticed, a buffer variable consists of the
  1771. buffer name, preceded by a pound sign (#).
  1772.  
  1773. @subsection(Interactive variables)
  1774.  
  1775.     Interactive variables are actually a method to prompt the user
  1776. for a string.  This is done by using an at sign (@@) followed either with
  1777. a quoted string, or a variable containing a string.  The string is the
  1778. placed on the bottom line, and the editor waits for the user to type in
  1779. a string.  Then the string typed in by the users is returned as the
  1780. value of the interactive variable.  For example:
  1781.  
  1782. @begin(verbatim)
  1783.     set %quest "What file? "
  1784.     find-file @@%quest
  1785. @end(verbatim)
  1786.  
  1787.     will ask the user for a file name, and then attempt to find it.
  1788. Note also that complex expressions can be built up with these
  1789. operorators, such as:
  1790.  
  1791. @verbatim(@@&cat &cat "File to decode[" %default "]: ")
  1792.  
  1793.     which prompts the user with the concatinated string.
  1794.  
  1795. @section(Functions)
  1796.  
  1797.     Functions can be used to manipulate variables in various ways. 
  1798. Functions can have one, two, or three arguments.  These arguments will
  1799. always be placed after the function on the current command line.  For
  1800. example, if we wanted to increase the current fill column by two, using
  1801. emacs's set (^X-A) command, we would write:
  1802.  
  1803. @begin(group)
  1804. @begin(verbatim)
  1805.     set $fillcol &add $fillcol 2
  1806.      \    \      \      \     \____second operand
  1807.       \     \    \      \_________first operand
  1808.        \      \     \_______________function to execute
  1809.         \      \_____________________variable to set
  1810.          \___________________________set (^X-A) command
  1811. @end(verbatim)
  1812. @end(group)
  1813.  
  1814.     Function names always begin with the ampresand (&) character,
  1815. and are only significant to the first three characters after the
  1816. ampresand.  Functions will normal expect one of three types of
  1817. arguments, and will automatically convert types when needed.
  1818.  
  1819. @begin(description)
  1820. <num>@\an ascii string of digits which is interpeted as a numeric value. 
  1821. Any string which does not start with a digit or a minus sign (-) will be
  1822. considered zero. 
  1823.  
  1824. <str>@\An arbitrary string of characters.  At the moment, strings are
  1825. limited to 128 characters in length. 
  1826.  
  1827. <log>@\A logical value consisting of the string "TRUE" or "FALSE". 
  1828. Numeric strings will also evaluate to "FALSE" if they are equal to zero,
  1829. and "TRUE" if they are non-zero.  Arbitrary text strings will have the
  1830. value of "FALSE". 
  1831. @end(description)
  1832.  
  1833.     A list of the currently availible functions follows: (Once
  1834. again, send in those votes on what kind of functions you would like to
  1835. see added!) Functions are always used in lower case, the uppercase
  1836. letters in the function table are the short form of the function (ie
  1837. &div for ÷).
  1838.  
  1839. @begin(verbatim)
  1840. Numeric Functions:    (returns <num>)
  1841.  
  1842. &ADD        <num> <num>    Add two numbers
  1843. &SUB        <num> <num>    Subtract the second number from the first
  1844. &TIMes        <num> <num>    Multiply two numbers
  1845. &DIVide        <num> <num>    Divide the first number by the second
  1846.                 giving an integer result
  1847. &MOD        <num> <num>    Return the reminder of dividing the
  1848.                 first number by the second
  1849. &NEGate        <neg>        Multiply the arg by -1
  1850. &LENgth        <str>        Returns length of string
  1851. &SINdex        <str1> <str2>    Finds the position of <str2> within
  1852.                 <str1>. Returns zero if not found.
  1853. &ASCii        <str>        Return the ascii code of the first
  1854.                 character in <str>
  1855. &RND        <num>        Returns a random integer between 1 and <num>
  1856. &ABS        <num>        Returns the absolute value of <num>
  1857.  
  1858. String manipulation functions:    (returns <str>)
  1859.  
  1860. &CAT        <str> <str>    Concatinate the two strings to form one
  1861. &LEFt        <str> <num>    return the <num> leftmost characters
  1862.                 from <str>
  1863. &RIGht        <str> <num>    return the <num> rightmost characters
  1864.                 from <str>
  1865. &MID        <str> <num1> <num2>
  1866.                 Starting from <num1> position in <str>,
  1867.                 return <num2> characters.
  1868. &UPPer        <str>        Uppercase <str>
  1869. &LOWer        <str>        lowercase <str>
  1870. &CHR        <num>        return a string with the character
  1871.                 represented by ascii code <num>
  1872. >K                return a string containing a single
  1873.                 keystroke from the user
  1874.  
  1875. Logical Testing functions:    (returns <log>)
  1876.  
  1877. &NOT        <log>        Return the opposite logical value
  1878. &AND        <log1> <log2>    Returns TRUE if BOTH logical arguments
  1879.                 are TRUE
  1880. &OR        <log1> <log2>    Returns TRUE if either argument
  1881.                 is TRUE
  1882. &EQUal        <num> <num>    If <num> and <num> are numerically
  1883.                 equal, return TRUE
  1884. &LESs        <num1> <num2>    If <num1> is less than <num2>, return
  1885.                 TRUE.
  1886. &GREater    <num1> <num2>    If <num1> is greater than, or equal to
  1887.                 <num2>, return TRUE.
  1888. &SEQual        <str1> <str2>    If the two strings are the same, return
  1889.                 TRUE.
  1890. &SLEss        <str1> <str2>    If <str1> is less alphabetically than
  1891.                 <str2>, return TRUE.
  1892. &SGReater    <str1> <str2>    If <str1> is alphabetically greater than
  1893.                 or equal to <str2>, return TRUE.
  1894.  
  1895. Special Functions:
  1896.  
  1897. &INDirect    <str>        Evaluate <str> as a variable.
  1898. @end(verbatim)
  1899.  
  1900.     This last function deserves more explanation. The &IND function
  1901. evaluates its argument, takes the resulting string, and then uses it as
  1902. a variable name.  For example, given the following code sequence:
  1903.  
  1904. @begin(verbatim)
  1905.     ; set up reference table
  1906.  
  1907.     set %one    "elephant"
  1908.     se    "giraffe"
  1909.     set %t    "donkey"
  1910.  
  1911.     set %index "two"
  1912.     insert-string &ind %index
  1913. @end(verbatim)
  1914.  
  1915.     the string "giraffe" would have been inserted at the point in
  1916. the current buffer.  This indirection can be safely nested up to about
  1917. 10 levels.
  1918.  
  1919. @section(Directives)
  1920.  
  1921.     Directives are commands which only operate within an executing
  1922. macro, ie they do not make sense as a single command. As such, they
  1923. cannot be called up singly or bound to keystroke. Used within macros,
  1924. they control what lines are executed and in what order.
  1925.  
  1926.     Directives always start with the exclamation mark (!) character
  1927. and must be the first thing placed on a line. Directives executed singly
  1928. (via the execute-command-line command) interactively will be ignored.
  1929.  
  1930. @subsection(!ENDM Directive)
  1931.  
  1932.     This directive is used to terminate a macro being stored. For
  1933. example, if a file is being executed contains the text:
  1934.  
  1935. @begin(verbatim)
  1936.     ;    Read in a file in view mode, and make the window red
  1937.  
  1938.     26    store-macro
  1939.         find-file @@"File to view: "
  1940.         add-mode "view"
  1941.         add-mode "red"
  1942.     !endm
  1943.  
  1944.     write-message "[Consult macro has been loaded]"
  1945. @end(verbatim)
  1946.  
  1947.     only the lines between the store-macro command and the !ENDM
  1948. directive are stored in macro 26.
  1949.  
  1950. @subsection(!FORCE Directive)
  1951.  
  1952.     When MicroEMACS executes a macro, if any command fails, the
  1953. macro is terminated at that point. If a line is preceeded by a !FORCE
  1954. directive, execution continues weather the command succeeds or not. For
  1955. example:
  1956.  
  1957. @begin(verbatim)
  1958.     ;    Merge the top two windows
  1959.  
  1960.     save-window        ;remember what window we are at
  1961.     1 next-window        ;go to the top window
  1962.     delete-window        ;merge it with the second window
  1963.     !force restore-window    ;This will continue irregardless
  1964.     add-mode "red"
  1965. @end(verbatim)
  1966.  
  1967. @subsection(!IF, !ELSE, and !ENDIF Directives)
  1968.  
  1969.     This directive allows statements only to be executed if a
  1970. condition specified in the directive is met.  Every line following the
  1971. !IF directive, until the first !ELSE or !ENDIF directive, is only
  1972. executed if the expresion following the !IF directive evaluates to a
  1973. TRUE value.  For example, the following macro segment creates the
  1974. portion of a text file automatically.  (yes believe me, this will be
  1975. easier to understand then that last explanation....)
  1976.  
  1977. @begin(verbatim)
  1978.     !if &sequal %curplace "timespace vortex"
  1979.         insert-string "First, rematerialize~n"
  1980.     !endif
  1981.     !if &sequal %planet "earth"    ;If we have landed on earth...
  1982.         !if &sequal %time "late 20th century"  ;and we are then
  1983.             write-message "Contact U.N.I.T."
  1984.         !else
  1985.             insert-string "Investigate the situation....~n"
  1986.             insert-string "(SAY 'stay here Sara')~n"
  1987.         !endif
  1988.     !else
  1989.         set %conditions @@"Atmosphere conditions outside? "
  1990.         !if &sequal %conditions "safe"
  1991.             insert-string &cat "Go outside......" "~n"
  1992.             insert-string "lock the door~n"
  1993.         !else
  1994.             insert-string "Dematerialize..try somewhen else"
  1995.             newline
  1996.         !endif
  1997.     !endif
  1998. @end(verbatim)
  1999.  
  2000. @subsection(!GOTO Directive)
  2001.  
  2002.     Flow can be controlled within a MicroEMACS macro using the !GOTO
  2003. directive. It takes as an argument a label. A label consists of a line
  2004. starting with an asterick (*) and then an alphanumeric label.  Only
  2005. labels in the currently executing macro can be jumped to, and trying to
  2006. jump to a non-existing label terminates execution of a macro.  For
  2007. example..
  2008.  
  2009. @begin(verbatim)
  2010.     ;Create a block of DATA statements for a BASIC program
  2011.  
  2012.         insert-string "1000 DATA "
  2013.         set %linenum 1000
  2014.  
  2015.     *nxtin
  2016.         update-screen        ;make sure we see the changes
  2017.         set %data @@"Next number: "
  2018.         !if &equal %data 0
  2019.             !goto finish
  2020.         !endif
  2021.  
  2022.         !if &greater $curcol 60
  2023.             2 delete-previous-character
  2024.             newline
  2025.             set %linenum &add %linenum 10
  2026.             insert-string &cat %linenum " DATA "
  2027.         !endif
  2028.  
  2029.         insert-string &cat %data ", "
  2030.         !goto nxtin
  2031.  
  2032.     *finish
  2033.  
  2034.         2 delete-previous-character
  2035.         newline
  2036. @end(verbatim)
  2037.  
  2038. @subsection(!WHILE and !ENDWHILE Directives)
  2039.  
  2040.     This directive allows you to set up repetative tasks easily and
  2041. efficiently. If a group of statements need to be executed while a
  2042. certain condition is tru, enclose them with a while loop. For example,
  2043.  
  2044. @begin(verbatim)
  2045.     !while &less $curcol 70
  2046.         insert-string &cat &cat "[" #stuff "]"
  2047.     !endwhile
  2048. @end(verbatim)
  2049.  
  2050.     places items from buffer "item" in the current line until the
  2051. cursor is at or past column 70.  While loops may be nested and can
  2052. contain and be the targets of !GOTOs with no ill effects. Using a while
  2053. loop to enclose a repeated task will run much faster than the
  2054. corresponding construct using !IFs.
  2055.  
  2056. @subsection(!BREAK Directive)
  2057.  
  2058.     This directive allows the user to abort out of the currently
  2059. most inner while loop, regardless of the condition.  It is often used
  2060. to abort processing for error conditions.  For example:
  2061.  
  2062. @begin(verbatim)
  2063. ;    Read in files and substitute "begining" with "beginning"
  2064.  
  2065.     set %filename #list
  2066.     !while ¬ &seq %filename "<end>"
  2067. !force        find-file %filename
  2068.         !if &seq $status FALSE
  2069.             write-message "[File read error]"
  2070.             !break
  2071.         !endif
  2072.         beginning-of-file
  2073.         replace-string "begining" "beginning"
  2074.         save-file
  2075.         set %filename #list
  2076.     !endwhile
  2077. @end(verbatim)
  2078.  
  2079.     This while loop will process files until the list is exhausted
  2080. or there is an error while reading a file.
  2081.  
  2082. @subsection(!RETURN Directive)
  2083.  
  2084.     The !RETURN Directive causes the current macro to exit, either
  2085. returning to the caller (if any) or to interactive mode.  For example:
  2086.  
  2087. @begin(verbatim)
  2088.     ;    Check the monitor type and set %mtyp
  2089.  
  2090.     !if &sres "CGA"
  2091.         set %mtyp 1
  2092.         !return
  2093.     !else
  2094.         set %mtyp 2
  2095.     !endif
  2096.  
  2097.     insert-string "You are on a MONOCHROME machine!~n"
  2098. @end(verbatim)
  2099. @appendix(MicroEMACS commands)
  2100.  
  2101.     Below is a complete list of the commands in EMACS, the keys
  2102. normally used to do the command, and what the command does.  Remember,
  2103. on some computers there may also be additional ways of using a command
  2104. (cursor keys and special function keys for example). 
  2105.  
  2106. @begin(verbatim)
  2107. @u(Command            Binding        Meaning)
  2108. abort-command         ^G    This allows the user to abort out of any
  2109.                 command that is waiting for input
  2110.  
  2111. add-mode         ^X-M    Add a mode to the current buffer
  2112.  
  2113. add-global-mode      M-M    Add a global mode for all new buffers
  2114.  
  2115. apropos          M-A    List out commands whose name contains
  2116.                 the string specified
  2117.  
  2118. backward-character     ^B    Move one character to the left
  2119.  
  2120. begin-macro         ^X-(    Begin recording a keyboard macro
  2121.  
  2122. beginning-of-file     M-<    Move to the beginning of the file in
  2123.                 the current buffer
  2124.  
  2125. beginning-of-line     ^A    Move to the beginning of the current line
  2126.  
  2127. bind-to-key         M-K    Bind a key to a function
  2128.  
  2129. buffer-position      ^X-=    List the position of the cursor in the
  2130.                 current window on the command line
  2131.  
  2132. case-region-lower     ^X-^L    Make a marked region all lower case
  2133.  
  2134. case-region-upper     ^X-^U    Make a marked region all upper case
  2135.  
  2136. case-word-capitalize     M-C    Capitalize the following word
  2137.  
  2138. case-word-lower      M-L    Lower case the following word
  2139.  
  2140. case-word-upper      M-U    Upper case the following word
  2141.  
  2142. change-file-name     ^X-N    Change the name of the file in the
  2143.                 current buffer
  2144.  
  2145. change-screen-size     M-^S    Chnage the number of lines of the screen
  2146.                 currently being used
  2147.  
  2148. change-screen-width     M-^T    Change the number of columns of the
  2149.                 screen currently being used
  2150.  
  2151. clear-and-redraw     ^L    Clear the physical screen and redraw it
  2152.  
  2153. clear-message-line    (none)    Clear the command line
  2154.  
  2155. copy-region         M-W    Copy the currently marked region into
  2156.                 the kill buffer
  2157.  
  2158. count-words         M-^C    Count how many words, lines and
  2159.                 characters are in the current marked region
  2160.  
  2161. ctlx-prefix         ^X    Change the key used as the ^X prefix
  2162.  
  2163. delete-blank-lines     ^X-^O    Delete all blank lines around the cursor
  2164.  
  2165. delete-buffer         ^X-K    Delete a buffer which is not being
  2166.                 currently displayed in a window
  2167.  
  2168. delete-mode         ^X-^M    Turn off a mode in the current buffer
  2169.  
  2170. delete-global-mode     M-^M    Turn off a global mode
  2171.  
  2172. delete-next-character     ^D    Delete the character following the cursor
  2173.  
  2174. delete-next-word     M-D    Delete the word following the cursor
  2175.  
  2176. delete-other-windows     ^X-1    Make the current window cover the entire
  2177.                 screen
  2178.  
  2179. delete-previous-character^H    Delete the character to the left of the
  2180.                 cursor
  2181.  
  2182. delete-previous-word     M-^H    Delete the word to the left of the cursor
  2183.  
  2184. delete-window         ^X-0    Remove the current window from the screen
  2185.  
  2186. describe-bindings    (none)    Make a list of all legal commands
  2187.  
  2188. describe-key         ^X-?    Describe what command is bound to a
  2189.                 keystroke sequence
  2190.  
  2191. detab-line         ^X-^D    Change all tabs in a line to the
  2192.                 equivilant spaces
  2193.  
  2194. end-macro         ^X-)    stop recording a keyboard macro
  2195.  
  2196. end-of-file         M->    Move cursor to the end of the current buffer
  2197.  
  2198. end-of-line         ^E    Move to the end of the current line
  2199.  
  2200. entab-line         ^X-^E    Change multiple spaces to tabs where
  2201.                 possible
  2202.  
  2203. exchange-point-and-mark  ^X-^X    Move cursor to the last marked spot,
  2204.                 make the original position be marked
  2205.  
  2206. execute-buffer        (none)    Execute a buffer as a macro
  2207.  
  2208. execute-command-line    (none)    Execute a line typed on the command
  2209.                 line as a macro command
  2210.  
  2211. execute-file         FNB    Execute a file as a macro
  2212.  
  2213. execute-macro         ^X-E    Execute the keyboard macro (play back
  2214.                 the recorded keystrokes)
  2215. execute-macro-<n>    (none)    Execute numbered macro <N> where <N> is
  2216.                 an integer from 1 to 40
  2217.  
  2218. execute-named-command     M-X    Execute a command by name
  2219.  
  2220. execute-procedure     M-^E    Execute a procedure by name
  2221.  
  2222. exit-emacs         ^X-^C    Exit EMACS. If there are unwritten,
  2223.                 changed buffers EMACS will ask to confirm
  2224.  
  2225. fill-paragraph         M-Q    Fill the current paragraph
  2226.  
  2227. filter-buffer         ^X-#    Filter the current buffer through an
  2228.                 external filter
  2229.  
  2230. find-file         ^X-^F    Find a file to edit in the current window
  2231.  
  2232. forward-character     ^F    Move cursor one character to the right
  2233.  
  2234. goto-line         M-G    Goto a numbered line
  2235.  
  2236. goto-matching-fence     M-^F    Goto the matching fence
  2237.  
  2238. grow-window         ^X-^    Make the current window larger
  2239.  
  2240. handle-tab         ^I    Insert a tab or set tab stops
  2241.  
  2242. hunt-forward         FN=    Hunt for the next match of the last
  2243.                 search string
  2244.  
  2245. hunt-backward         FN>    Hunt for the last match of the last
  2246.                 search string
  2247.  
  2248. help             M-?    Read EMACS.HLP into a buffer and display it
  2249.  
  2250. i-shell          ^X-C    Shell up to a new command processor
  2251.  
  2252. incremental-search     ^X-S    Search for a string, incrementally
  2253.  
  2254. insert-file         ^X-^I    insert a file at the cursor in the
  2255.                 current file
  2256.  
  2257. insert-space         ^C    Insert a space to the right of the cursor
  2258.  
  2259. insert-string        (none)    Insert a string at the cursor
  2260.  
  2261. kill-paragraph         M-^W    Delete the current paragraph
  2262.  
  2263. kill-region         ^W    Delete the current marked region, moving
  2264.                 it to the kill buffer
  2265.  
  2266. kill-to-end-of-line     ^K    Delete the rest of the current line
  2267.  
  2268. list-buffers         ^X-^B    List all existing buffers
  2269.  
  2270. meta-prefix         <ESC>    Key used to preceed all META commands
  2271.  
  2272. move-window-down     ^X-^N    Move all the lines in the current window down
  2273.  
  2274. move-window-up         ^X-^P    Move all the lines in the current window up
  2275.  
  2276. name-buffer         M-^N    Change the name of the current buffer
  2277.  
  2278. newline          ^M    Insert a <NL> at the cursor
  2279.  
  2280. newline-and-indent     ^J    Insert a <NL> at the cursor and indent
  2281.                 the new line the same as the preceeding line
  2282.  
  2283. next-buffer         ^X-X    Bring the next buffer in the list into
  2284.                 the current window
  2285.  
  2286. next-line         ^N    Move the cursor down one line
  2287.  
  2288. next-page         ^V    Move the cursor down one page
  2289.  
  2290. next-paragraph         M-N    Move cursor to the next paragraph
  2291.  
  2292. next-window         ^X-O    Move cursor to the next window
  2293.  
  2294. next-word         M-F    Move coursor to the beginning of the
  2295.                 next word
  2296.  
  2297. nop             M-FNC    Does nothing
  2298.  
  2299. open-line         ^O    Open a line at the cursor
  2300.  
  2301. pipe-command         ^X-@@    Execute an external command and place
  2302.                 its output in a buffer
  2303.  
  2304. previous-line         ^P    Move cursor up one line
  2305.  
  2306. previous-page         ^Z    Move cursor up one page
  2307.  
  2308. previous-paragraph     M-P    Move back one paragraph
  2309.  
  2310. previous-window      ^X-P    Move the cursor to the last window
  2311.  
  2312. previous-word         M-B    Move the cursor to the beginning of the
  2313.                 word to the left of the cursor
  2314.  
  2315. query-replace-string     M-^R    Reaplace all of one string with another
  2316.                 string, interactivly quering the user
  2317.  
  2318. quick-exit         M-Z    Exit EMACS, writing out all changed buffers
  2319.  
  2320. quote-character      ^Q    Insert the next character literally
  2321.  
  2322. read-file         ^X-^R    Read a file into the current buffer
  2323.  
  2324. redraw-display         M-^L    Redraw the display, centering the
  2325.                 current line
  2326.  
  2327. resize-window         ^X-W    Change the number of lines in the
  2328.                 current window
  2329.  
  2330. restore-window        (none)    Move cursor to the last saved window
  2331.  
  2332. replace-string         M-R    Replace all occurences of one string
  2333.                 with another string from the cursor
  2334.                 to the end of the buffer
  2335.  
  2336. reverse-incremental-search^X-R    Search backwards, incrementally
  2337.  
  2338. run             M-^E    Execute a named procedure
  2339.  
  2340. save-file         ^X-^S    Save the current buffer if it is changed
  2341.  
  2342. save-window        (none)    Remember current window (to restore later)
  2343.  
  2344. scroll-next-up         M-^Z    Scroll the next window up
  2345.  
  2346. scroll-next-down     M-^V    Scroll the next window down
  2347.  
  2348. search-forward         ^S    Search for a string
  2349.  
  2350. search-reverse         ^R    Search backwards for a string
  2351.  
  2352. select-buffer         ^X-B    Select a buffer to display in the
  2353.                 current window
  2354.  
  2355. set             ^X-A    Set a variable to a value
  2356.  
  2357. set-encryption-key     M-E    Set the encryption key of the current buffer
  2358.  
  2359. set-fill-column      ^X-F    Set the current fill column
  2360.  
  2361. set-mark            Set the mark
  2362.  
  2363. shell-command         ^X-!    Execute an external command
  2364.  
  2365. shrink-window         ^X-^Z    Make the current window smaller
  2366.  
  2367. split-current-window     ^X-2    Split the current window in two
  2368.  
  2369. store-macro        (none)    Store the following macro lines to a
  2370.                 numbered macro
  2371.  
  2372. store-procedure        (none)    Store the following macro lines to a
  2373.                 named procedure
  2374.  
  2375. transpose-characters     ^T    Transpose the character at the cursor
  2376.                 with the character to the left
  2377.  
  2378. trim-line         ^X-^T    Trim any trailing whitespace from line
  2379.  
  2380. unbind-key         M-^K    Unbind a key from a function
  2381.  
  2382. universal-argument     ^U    Execute the following command 4 times
  2383.  
  2384. unmark-buffer         M-~    Unmark the current buffer (so it is
  2385.                 no longer changed)
  2386.  
  2387. update-screen        (none)    Force a screen update during macro execution
  2388.  
  2389. view-file         ^X-^V    Find a file,and put it in view mode
  2390.  
  2391. wrap-word         M-FNW    Wrap the current word, this is an
  2392.                 internal function
  2393.      
  2394. write-file         ^X-^W    Write the current buffer under a new
  2395.                 file name
  2396.  
  2397. write-message        (none)    Display a string on the command line
  2398.  
  2399. yank             ^Y    yank the kill buffer into the current
  2400.                 buffer at the cursor
  2401. @end(verbatim)
  2402. @appendix(MicroEMACS Bindings)
  2403.  
  2404.     Below is a complete list of the key bindings used in MicroEMACS.
  2405. This can be used as a wall chart reference for MicroEMACS commands.
  2406.  
  2407. @begin(verbatim)
  2408. @center(@b[Default Key Bindings for MicroEmacs 3.9])
  2409.  
  2410.  ^A   Move to start of line          ESC A   Apropos (list some commands)
  2411.  ^B   Move backward by characters     ESC B   Backup by words
  2412.  ^C   Insert space              ESC C   Initial capitalize word
  2413.  ^D   Forward delete              ESC D   Delete forward word
  2414.  ^E   Goto end of line              ESC E   Reset Encryption Key
  2415.  ^F   Move forward by characters      ESC F   Advance by words
  2416.  ^G   Abort out of things          ESC G   Go to a line
  2417.  ^H   Backward delete              
  2418.  ^I   Insert tab/Set tab stops
  2419.  ^J   Insert CR-LF, then indent             
  2420.  ^K   Kill forward              ESC K   Bind Key to function
  2421.  ^L   Refresh the screen          ESC L   Lower case word
  2422.  ^M   Insert CR-LF              ESC M   Add global mode
  2423.  ^N   Move forward by lines          ESC N   Goto End paragraph
  2424.  ^O   Open up a blank line          
  2425.  ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  2426.  ^Q   Insert literal              ESC Q   Fill current paragraph
  2427.  ^R   Search backwards              ESC R   Search and replace
  2428.  ^S   Search forward
  2429.  ^T   Transpose characters               
  2430.  ^U   Repeat command four times       ESC U   Upper case word
  2431.  ^V   Move forward by pages          ESC V   Move backward by pages
  2432.  ^W   Kill region              ESC W   Copy region to kill buffer
  2433.  ^Y   Yank back from killbuffer       ESC X   Execute named command
  2434.  ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  2435.  
  2436.  ESC ^C   Count words in region       ESC ~   Unmark current buffer
  2437.  ESC ^F   Goto matching fence          ESC !   Reposition window
  2438.  ESC ^H   Delete backward word          ESC <   Move to start of buffer
  2439.  ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  2440.  ESC ^L   Reposition window          ESC .   Set mark
  2441.  ESC ^M   Delete global mode          ESC space    Set mark
  2442.  ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  2443.  ESC ^R   Search & replace w/query      rubout   Backward delete
  2444.  ESC ^S   Change screen rows
  2445.  ESC ^T   Change screen columns
  2446.  ESC ^V   Scroll next window down
  2447.  ESC ^W   Delete Paragraph
  2448.  ESC ^Z   Scroll next window up
  2449.  
  2450.  ^X ?    Describe a key           ^X !   Run 1 command in a subjob
  2451.  ^X =    Show the cursor position   ^X @@   Pipe DOS command to buffer
  2452.  ^X ^    Enlarge display window       ^X #   Filter buffer thru DOS filter
  2453.  ^X 0    Delete current window       ^X (   Begin macro
  2454.  ^X 1    Delete other windows       ^X )   End macro
  2455.  ^X 2    Split current window
  2456.                    ^X A   Set variable value
  2457.  ^X ^B     Display buffer list       ^X B   Switch a window to a buffer
  2458.  ^X ^C     Exit MicroEMACS       ^X C   Start a new command processer
  2459.  ^X ^D   Detab line           ^X D   Suspend MicroEMACS (BSD4.2 only)
  2460.  ^X ^E     Entab line           ^X E   Execute macro
  2461.  ^X ^F     Find file           ^X F   Set fill column
  2462.  ^X ^I     Insert file
  2463.                    ^X K   Delete buffer
  2464.  ^X ^L     Lower case region
  2465.  ^X ^M     Delete Mode           ^X M   Add a mode
  2466.  ^X ^N     Move window down       ^X N   Rename current filename
  2467.  ^X ^O     Delete blank lines       ^X O   Move to the next window
  2468.  ^X ^P     Move window up        ^X P   Move to the previous window
  2469.  ^X ^R     Get a file from disk       ^X R   Incremental reverse search
  2470.  ^X ^S     Save current file       ^X S   Incremental forward search
  2471.  ^X ^T   Trim line
  2472.  ^X ^U     Upper case region
  2473.  ^X ^V     View file
  2474.  ^X ^W     Write a file to disk       ^X W   resize Window
  2475.  ^X ^X     Swap "." and mark       ^X X   Use next buffer
  2476.  ^X ^Z     Shrink window           ^X Z   Enlarge display window
  2477.  
  2478. Only under PCDOS:
  2479.  <ALT>-S Hunt forward         SHIFT <F1> - <F10>
  2480.  <ALT>-R Hunt backward         Execute macroes 1 - 10
  2481.  
  2482. @u(Usable Modes)
  2483. WRAP     Lines going past right margin "wrap" to a new line
  2484. VIEW     Read-Only mode where no modifications are allowed
  2485. CMODE     Change behavior of some commands to work with C better
  2486. EXACT     Exact case matching on search strings
  2487. OVER     Overwrite typed characters instead of inserting them
  2488. CRYPT     Current buffer will be encrypted on write, decrypted on read
  2489. MAGIC     Use regular expresion matching in searches
  2490. ASAVE     Save the file every 256 inserted characters
  2491.  
  2492. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK    Sets forground color
  2493. white/cyan/magenta/yellow/blue/red/green/black    Sets background color
  2494. @end(verbatim)
  2495. @newpage
  2496. @appendix(Supported machines)
  2497.  
  2498.     The following table lists all the hardware/compilers for which I
  2499. currently support MicroEMACS.  This is not exclusive of all machines
  2500. which MicroEMACS will run on, but I have either run it myself, or had a
  2501. first hand report of it running.
  2502.  
  2503. @begin(verbatim)
  2504. @u(Hardware    OS        Compiler    Comments)
  2505. VAX 780        UNIX V5        native
  2506.         UNIX V7        native
  2507.         BSD 4.2        native        job control supported
  2508.         *VMS        native        only some terminals supported
  2509.  
  2510. NCR Tower    UNIX V5        native
  2511.  
  2512. Fortune 32:16    UNIX V7        native
  2513.  
  2514. IBM-PC        MSDO        LATTICE    2.15    Large CODE/Large DATA
  2515.          2.0 & 3.2    AZTEC 3.4e    Small CODE/Large DATA
  2516.                 *MSC 4.0
  2517.                 *MWC 86
  2518.  
  2519. HP150        MSDOS        Lattice 2.15    Function key labels
  2520.                         for the touch screen
  2521.  
  2522. HP110        MSDOS        Lattice 2.15
  2523.                 Aztec 3.4e
  2524.  
  2525. *Data General 10
  2526.         MSDOS        Lattice 2.15
  2527.  
  2528. *Texas Instruments Professional
  2529.         MSDOS        Lattice 2.15
  2530.  
  2531. Amiga        Intuition    Lattice 3.03    no mouse or menus yet
  2532.                 *Aztec 3
  2533.  
  2534. ST520        TOS        Lattice 3.10    no menus yet,
  2535.                         no shell commands
  2536.  
  2537. @u[Systems to be supported (ie some code is already written:)]
  2538. Macintosh    Finder 5.0    Aztec
  2539.  
  2540. *means that I do not own or have access to the listed compiler and/or
  2541.  machine and must rely upon others to help support it. 
  2542. @end(verbatim)
  2543. @newpage
  2544. @appendix(Machine Dependent Notes)
  2545.  
  2546.     This appendix lists some notes specific to individual
  2547. implementations of MicroEMACS. Every attempt has been made to allow
  2548. EMACS to be identical on all machines, but we have also tried to take
  2549. advantage of function keys, cursor keys, mice, and special screen modes
  2550. where possible.
  2551.  
  2552. @appendixsection(IBM-PC/XT/AT and its clones)
  2553.  
  2554.     The IBM-PC family of computers is supported with a variety of
  2555. different display adapters.  EMACS will attempt to discover what adapter
  2556. is connected and use the proper driver for it.    Below is a list of the
  2557. currently supported video adapters:
  2558.  
  2559. @begin(verbatim)
  2560. @u(Adapter            $sres        Original mode used)
  2561. Monochrome Graphics Adapter    MONO        MONO
  2562. Color Graphics Adapter        CGA        CGA
  2563. Enhanced graphics Adapter    EGA        CGA
  2564. @end(verbatim)
  2565.  
  2566.     EMACS also takes advatage of various function keys and the keys
  2567. on the keypad on an IBM-PC.  The function keys are initially not bound
  2568. to any particular functions (except by the emacs.rc startup file), but
  2569. the keypad keys do default to the following:
  2570.  
  2571. @begin(verbatim)
  2572. @u(Keypad key    Function)
  2573. Home        beginning-of-file
  2574. CSRS UP        previous-line
  2575. Pg Up        previous-page
  2576. CSRS LEFT    backward-character
  2577. CSRS RIGHT    forward-character
  2578. End        end-of-file
  2579. CSRS DOWN    next-line
  2580. Pg Dn        Next-page
  2581. @end(verbatim)
  2582.  
  2583.     All these special keys are indicated in EMACS macroes by use of
  2584. the @b(FN) prefix.  Below is a list of many of the keys and the codes
  2585. used to specify them.  Also the codes may be gotten by using the
  2586. describe-key (^X ?) command on the suspect key.
  2587. @newpage
  2588. @begin(verbatim)
  2589.             IBM PC function keys in MicroEmacs
  2590.  
  2591.     function    Function    ^function    Alt-function
  2592.  f1)      FN;          FNT          FN^          FNh
  2593.  f2)      FN<          FNU          FN_          FNi
  2594.  f3)      FN=          FNV          FN`          FNj
  2595.  f4)      FN>          FNW          FNa          FNk
  2596.  f5)      FN?          FNX          FNb          FNl
  2597.  f6)      FN@@          FNY          FNc          FNm
  2598.  f7)      FNA          FNZ          FNd          FNn
  2599.  f8)      FNB          FN[          FNe          FNo
  2600.  f9)      FNC          FN\          FNf          FNp
  2601. f10)      FND          FN]          FNg          FNq
  2602.  
  2603. home)      FNG                  FNw
  2604. CuUp)      FNH
  2605. PgUp)      FNI                  FNä {Alt 132}
  2606. CuLf)      FNK                  FNs
  2607.  5  )
  2608. CuRt)      FNM                  FNt
  2609.  End)      FNO                  FNu
  2610. CuDn)      FNP
  2611. PgDn)      FNQ                  FNv
  2612.  Ins)      FNR
  2613.  Del)      FNS
  2614. @end(verbatim)
  2615. @newpage
  2616. @appendixsection(HP 150)
  2617.  
  2618.     This machine from Hewlett Packard is very unusual for an MSDOS
  2619. machine.  It has a touch screen and is very function key oriented.  An
  2620. additional command, @i(label-function-key)@index(label-function-key)
  2621. allows you to place labels on the on screen function key labels.  A
  2622. numeric argument indicates which function key to label (one through
  2623. eight) and then the program prompts for a 16 character label, which will
  2624. be used as two lines of eight characters.  To label function key three
  2625. with "save file" from a macro, you would use:
  2626.  
  2627. @verbatim(3 label-function-key "save    file")
  2628.  
  2629.     Notice the 4 spaces after "save". This forces "file" to begin on
  2630. the second line of the label.
  2631. @newpage
  2632. @appendixsection(Atari 520/1040ST)
  2633.  
  2634.     The ATARI ST family of computers have a dual personality.  They
  2635. may use either a monochrome or a color screen.    EMACS supports two
  2636. screen resolutions on each monitor. 
  2637.  
  2638. @begin(verbatim)
  2639. @u(Monitor $sres size #color $palette format)
  2640. Color    LOW    40x25    16    000111222333444555666777
  2641.     MEDIUM    80x25    4    000111222333
  2642. Mono    HIGH    80x25    2    000
  2643.     DENSE    80x40    2    000
  2644. @end(verbatim)
  2645.  
  2646.     The $palette environment variable can be used to change what
  2647. color is associated with each color name.  With a color monitor, each
  2648. group of three digits indicates an octal number specifying the RED,
  2649. GREEN and BLUE levels of that color.  Each color digit can vary from 0
  2650. to 7.  For example, the initial setting of $palette in LOW resolution is:
  2651.  
  2652. @begin(verbatim)
  2653.     000700070770007707077777
  2654.  
  2655.     which broken up is:
  2656.  
  2657.     000 700 070 770 007 707 077 777
  2658.  
  2659.     which means:
  2660.  
  2661.     000    Black
  2662.     700    Red
  2663.     070    Green
  2664.     770    Yellow
  2665.     007    Blue
  2666.     707    Magenta
  2667.     077    Cyan
  2668.     777    White
  2669. @end(verbatim)
  2670.  
  2671. @quotation[@i(Note: DENSE mode is not yet supported in 3.9.  It will be
  2672. soon)]
  2673.  
  2674.     Also the mouse generates FN prefix codes when moved, or when one
  2675. of the two buttons is pressed.    Initially the movement of the mouse is
  2676. bound to movement of the cursor, and the left mouse button generates a
  2677. set-mark (M-space) command.  The cursor keys and the function keys are
  2678. bound similarly to to IBM-PC.
  2679. @newpage
  2680. @appendixsection(Amiga 1000)
  2681.  
  2682.     The Commodore AMIGA 1000 version of MicroEMACS does not have
  2683. extensive support of the mouse or of pull down menus as of yet.  It does
  2684. however come up in a window, and it is possible to re-size it to run in
  2685. different sized windows.  The @b(M-^S) @i(change-screen-size)
  2686. @index(change-screen-size) takes its numeric argument as the new number
  2687. of lines for EMACS to use.  The @b(M-^T) @i(change-screen-width)
  2688. @index(change-screen-width) command allows you to change the number of
  2689. columns EMACS will use.  The defaults for these are 23 lines and 77
  2690. characters across for a full screen window.
  2691.  
  2692. @center(Note about Compiling MicroEMACS)
  2693.  
  2694. @begin(quotation)
  2695.     If you are compiling the sources on the AMIGA to produce an
  2696. executable image, and you are using the Lattice compiler, be sure to
  2697. give the CLI command 'STACK 40000' before compiling to make sure the
  2698. compiler has sufficient stack space to successfully complete
  2699. compiliation.
  2700. @end(quotation)
  2701. @newpage
  2702. @appendixsection(UNIX V5, V7, and BSD4.[23])
  2703.  
  2704.     MicroEMACS under UNIX utilizes the @b(TERMCAP) @index(termcap)
  2705. library to provide machine independent screen functions.  Make sure that
  2706. termcap is availible and properly set on your account before attempting
  2707. to use MicroEMACS. 
  2708.  
  2709.     Under systems which support job control, you can use the
  2710. @b(^X-D) @i(suspend-emacs) @index(suspend-emacs) command to place EMACS
  2711. into the background.  This carries a much smaller overhead than bringing
  2712. up a new shell under EMACS.  EMACS will properly redraw the screen when
  2713. you bring it back to the forground.
  2714.  
  2715.     With the addition of some very machine/operating system specific
  2716. code, EMACS can prevent two or more people from modifying the same file
  2717. at the same time.  @index(file locking) The upper level of a set of
  2718. functions to provide file locking exist in the source file @b(LOCK.C). 
  2719. It requires two machine specific functions written and linked into EMACS
  2720. for it to operate properly. 
  2721.  
  2722. @begin(verbatim)
  2723.     char *dolock(fname)
  2724.  
  2725.     char *fname;
  2726.  
  2727.     dolock() locks a file, preventing others from modifying it. If
  2728.     it succeeds, it returns NULL, otherwise it returns a pointer to
  2729.     a string in the form "LOCK ERROR: explination".
  2730.  
  2731.     char *undolock(fname)
  2732.  
  2733.     char *fname;
  2734.  
  2735.     undolock() unlocks a file, allowing others to modifying it. If
  2736.     it succeeds, it returns NULL, otherwise it returns a pointer to
  2737.     a string in the form "LOCK ERROR: explination".
  2738. @end(verbatim)
  2739. @newpage
  2740. @appendix(Mode Flags)
  2741.  
  2742.     The two environment variables, $cmode and $gmode, contain a
  2743. number the corrosponds to the modes set for the current buffer and
  2744. theeditor as a whole.  These are encoded as the sum of the following
  2745. numbers for each of the possible modes:
  2746.  
  2747. @begin(verbatim)
  2748. WRAP      1        Word wrap
  2749. CMODE      2        C indentation and fence match
  2750. SPELL      4        Interactive spell checking (Not Implemented Yet)
  2751. EXACT      8        Exact matching for searches
  2752. VIEW     16        Read-only buffer
  2753. OVER     32        Overwrite mode
  2754. MAGIC     64        Regular expresions in search
  2755. CRYPT    128        Encrytion mode active
  2756. ASAVE    256        Auto-save mode
  2757. @end(verbatim)
  2758.  
  2759.     So, if you wished to set the current buffer to have CMODE,
  2760. EXACT, and MAGIC on, and all the others off, you would add up the values
  2761. for those three, CMODE 2  +  EXACT 8  +  MAGIC 64 = 74, and use a
  2762. statement like:
  2763.  
  2764. set $cmode 74
  2765.